<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Chapter 25 MySQL Performance Schema</title>
<link rel="stylesheet" href="mvl.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets + chunker.py v1.9.2" />
<link rel="start" href="index.html" title="{book-title}" />
<link rel="up" href="" title="" />
<link rel="prev" href="information-schema.html" title="Chapter 24 INFORMATION_SCHEMA Tables" />
<link rel="next" href="sys-schema.html" title="Chapter 26 MySQL sys Schema" />
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Chapter 25 MySQL Performance Schema</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="information-schema.html">Prev</a> </td>
<th width="60%" align="center"></th>
<td width="20%" align="right"> <a accesskey="n" href="sys-schema.html">Next</a></td>
</tr>
</table>
<hr>
</div>
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title"><a name="performance-schema"></a>Chapter 25 MySQL Performance Schema</h1>

</div>

</div>

</div>
<div class="toc">
<p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="performance-schema.html#performance-schema-quick-start">25.1 Performance Schema Quick Start</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-build-configuration">25.2 Performance Schema Build Configuration</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-startup-configuration">25.3 Performance Schema Startup Configuration</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-runtime-configuration">25.4 Performance Schema Runtime Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="performance-schema.html#performance-schema-timing">25.4.1 Performance Schema Event Timing</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-filtering">25.4.2 Performance Schema Event Filtering</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-pre-filtering">25.4.3 Event Pre-Filtering</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-instrument-filtering">25.4.4 Pre-Filtering by Instrument</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-object-filtering">25.4.5 Pre-Filtering by Object</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-thread-filtering">25.4.6 Pre-Filtering by Thread</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-consumer-filtering">25.4.7 Pre-Filtering by Consumer</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-consumer-configurations">25.4.8 Example Consumer Configurations</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-filtering-names">25.4.9 Naming Instruments or Consumers for Filtering Operations</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-instrumentation-checking">25.4.10 Determining What Is Instrumented</a></span></dt></dl></dd><dt><span class="section"><a href="performance-schema.html#performance-schema-queries">25.5 Performance Schema Queries</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-instrument-naming">25.6 Performance Schema Instrument Naming Conventions</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-status-monitoring">25.7 Performance Schema Status Monitoring</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-atom-molecule-events">25.8 Performance Schema Atom and Molecule Events</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-statement-digests">25.9 Performance Schema Statement Digests</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-table-characteristics">25.10 Performance Schema General Table Characteristics</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-table-descriptions">25.11 Performance Schema Table Descriptions</a></span></dt><dd><dl><dt><span class="section"><a href="performance-schema.html#performance-schema-table-index">25.11.1 Performance Schema Table Index</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-setup-tables">25.11.2 Performance Schema Setup Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-instance-tables">25.11.3 Performance Schema Instance Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-wait-tables">25.11.4 Performance Schema Wait Event Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-stage-tables">25.11.5 Performance Schema Stage Event Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-statement-tables">25.11.6 Performance Schema Statement Event Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-transaction-tables">25.11.7 Performance Schema Transaction Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-connection-tables">25.11.8 Performance Schema Connection Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-connection-attribute-tables">25.11.9 Performance Schema Connection Attribute Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-user-variable-tables">25.11.10 Performance Schema User Variable Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-replication-tables">25.11.11 Performance Schema Replication Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-lock-tables">25.11.12 Performance Schema Lock Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-system-variable-tables">25.11.13 Performance Schema System Variable Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-status-variable-tables">25.11.14 Performance Schema Status Variable Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-summary-tables">25.11.15 Performance Schema Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-miscellaneous-tables">25.11.16 Performance Schema Miscellaneous Tables</a></span></dt></dl></dd><dt><span class="section"><a href="performance-schema.html#performance-schema-option-variable-reference">25.12 Performance Schema Option and Variable Reference</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-options">25.13 Performance Schema Command Options</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-system-variables">25.14 Performance Schema System Variables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-status-variables">25.15 Performance Schema Status Variables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-memory-model">25.16 The Performance Schema Memory-Allocation Model</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-and-plugins">25.17 Performance Schema and Plugins</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-examples">25.18 Using the Performance Schema to Diagnose Problems</a></span></dt><dd><dl><dt><span class="section"><a href="performance-schema.html#performance-schema-query-profiling">25.18.1 Query Profiling Using Performance Schema</a></span></dt></dl></dd><dt><span class="section"><a href="performance-schema.html#performance-schema-variable-table-migration">25.19 Migrating to Performance Schema System and Status Variable Tables</a></span></dt></dl>
</div>
<a class="indexterm" name="idm139684631947776"></a><a class="indexterm" name="idm139684631946736"></a><a class="indexterm" name="idm139684631945648"></a><a class="indexterm" name="idm139684631944160"></a><p>
    The MySQL Performance Schema is a feature for monitoring MySQL
    Server execution at a low level. The Performance Schema has these
    characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
        The Performance Schema provides a way to inspect internal
        execution of the server at runtime. It is implemented using the
        <a class="link" href="performance-schema.html" title="Chapter 25 MySQL Performance Schema"><code class="literal">PERFORMANCE_SCHEMA</code></a> storage engine
        and the <code class="literal">performance_schema</code> database. The
        Performance Schema focuses primarily on performance data. This
        differs from <code class="literal">INFORMATION_SCHEMA</code>, which serves
        for inspection of metadata.
      </p></li><li class="listitem"><p>
        The Performance Schema monitors server events. An
        <span class="quote">“<span class="quote">event</span>”</span> is anything the server does that takes time
        and has been instrumented so that timing information can be
        collected. In general, an event could be a function call, a wait
        for the operating system, a stage of an SQL statement execution
        such as parsing or sorting, or an entire statement or group of
        statements. Event collection provides access to information
        about synchronization calls (such as for mutexes) file and table
        I/O, table locks, and so forth for the server and for several
        storage engines.
      </p></li><li class="listitem"><p>
        Performance Schema events are distinct from events written to
        the server's binary log (which describe data modifications) and
        Event Scheduler events (which are a type of stored program).
      </p></li><li class="listitem"><p>
        Performance Schema events are specific to a given instance of
        the MySQL Server. Performance Schema tables are considered local
        to the server, and changes to them are not replicated or written
        to the binary log.
      </p></li><li class="listitem"><p>
        Current events are available, as well as event histories and
        summaries. This enables you to determine how many times
        instrumented activities were performed and how much time they
        took. Event information is available to show the activities of
        specific threads, or activity associated with particular objects
        such as a mutex or file.
      </p></li><li class="listitem"><p>
        The <a class="link" href="performance-schema.html" title="Chapter 25 MySQL Performance Schema"><code class="literal">PERFORMANCE_SCHEMA</code></a> storage
        engine collects event data using <span class="quote">“<span class="quote">instrumentation
        points</span>”</span> in server source code.
      </p></li><li class="listitem"><p>
        Collected events are stored in tables in the
        <code class="literal">performance_schema</code> database. These tables can
        be queried using <a class="link" href="sql-syntax.html#select" title="13.2.9 SELECT Syntax"><code class="literal">SELECT</code></a>
        statements like other tables.
      </p></li><li class="listitem"><p>
        Performance Schema configuration can be modified dynamically by
        updating tables in the <code class="literal">performance_schema</code>
        database through SQL statements. Configuration changes affect
        data collection immediately.
      </p></li><li class="listitem"><p>
        Tables in the Performance Schema are in-memory tables that use
        no persistent on-disk storage. The contents are repopulated
        beginning at server startup and discarded at server shutdown.
      </p></li><li class="listitem"><p>
        Monitoring is available on all platforms supported by MySQL.
      </p><p>
        Some limitations might apply: The types of timers might vary per
        platform. Instruments that apply to storage engines might not be
        implemented for all storage engines. Instrumentation of each
        third-party engine is the responsibility of the engine
        maintainer. See also
        <a class="xref" href="restrictions.html#performance-schema-restrictions" title="C.8 Restrictions on Performance Schema">Section C.8, “Restrictions on Performance Schema”</a>.
      </p></li><li class="listitem"><p>
        Data collection is implemented by modifying the server source
        code to add instrumentation. There are no separate threads
        associated with the Performance Schema, unlike other features
        such as replication or the Event Scheduler.
</p></li></ul>
</div>
<p>
    The Performance Schema is intended to provide access to useful
    information about server execution while having minimal impact on
    server performance. The implementation follows these design goals:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
        Activating the Performance Schema causes no changes in server
        behavior. For example, it does not cause thread scheduling to
        change, and it does not cause query execution plans (as shown by
        <a class="link" href="sql-syntax.html#explain" title="13.8.2 EXPLAIN Syntax"><code class="literal">EXPLAIN</code></a>) to change.
      </p></li><li class="listitem"><p>
        Server monitoring occurs continuously and unobtrusively with
        very little overhead. Activating the Performance Schema does not
        make the server unusable.
      </p></li><li class="listitem"><p>
        The parser is unchanged. There are no new keywords or
        statements.
      </p></li><li class="listitem"><p>
        Execution of server code proceeds normally even if the
        Performance Schema fails internally.
      </p></li><li class="listitem"><p>
        When there is a choice between performing processing during
        event collection initially or during event retrieval later,
        priority is given to making collection faster. This is because
        collection is ongoing whereas retrieval is on demand and might
        never happen at all.
      </p></li><li class="listitem"><p>
        It is easy to add new instrumentation points.
      </p></li><li class="listitem"><p>
        Instrumentation is versioned. If the instrumentation
        implementation changes, previously instrumented code will
        continue to work. This benefits developers of third-party
        plugins because it is not necessary to upgrade each plugin to
        stay synchronized with the latest Performance Schema changes.
</p></li></ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
      <a class="indexterm" name="idm139684631912160"></a>

      The MySQL <code class="literal">sys</code> schema is a set of objects that
      provides convenient access to data collected by the Performance
      Schema. The <code class="literal">sys</code> schema is installed by default.
      For usage instructions, see <a class="xref" href="sys-schema.html" title="Chapter 26 MySQL sys Schema">Chapter 26, <i>MySQL sys Schema</i></a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-quick-start"></a>25.1 Performance Schema Quick Start</h2>

</div>

</div>

</div>
<p>
      This section briefly introduces the Performance Schema with
      examples that show how to use it. For additional examples, see
      <a class="xref" href="performance-schema.html#performance-schema-examples" title="25.18 Using the Performance Schema to Diagnose Problems">Section 25.18, “Using the Performance Schema to Diagnose Problems”</a>.
    </p><p>
      The Performance Schema is enabled by default. To enable or disable
      it explicitly, start the server with the
      <a class="link" href="performance-schema.html#sysvar_performance_schema"><code class="literal">performance_schema</code></a> variable set
      to an appropriate value. For example, use these lines in the
      server <code class="filename">my.cnf</code> file:
    </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance_schema=ON
</pre><p>
      When the server starts, it sees
      <a class="link" href="performance-schema.html#sysvar_performance_schema"><code class="literal">performance_schema</code></a> and attempts
      to initialize the Performance Schema. To verify successful
      initialization, use this statement:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SHOW VARIABLES LIKE 'performance_schema';</code></strong>
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| performance_schema | ON    |
+--------------------+-------+
</pre><p>
      A value of <code class="literal">ON</code> means that the Performance Schema
      initialized successfully and is ready for use. A value of
      <code class="literal">OFF</code> means that some error occurred. Check the
      server error log for information about what went wrong.
    </p><p>
      The Performance Schema is implemented as a storage engine. If this
      engine is available (which you should already have checked
      earlier), you should see it listed with a
      <code class="literal">SUPPORT</code> value of <code class="literal">YES</code> in the
      output from the
      <a class="link" href="information-schema.html#engines-table" title="24.7 The INFORMATION_SCHEMA ENGINES Table"><code class="literal">INFORMATION_SCHEMA.ENGINES</code></a> table or
      the <a class="link" href="sql-syntax.html#show-engines" title="13.7.5.16 SHOW ENGINES Syntax"><code class="literal">SHOW ENGINES</code></a> statement:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM INFORMATION_SCHEMA.ENGINES</code></strong>
       <strong class="userinput"><code>WHERE ENGINE='PERFORMANCE_SCHEMA'\G</code></strong>
*************************** 1. row ***************************
      ENGINE: PERFORMANCE_SCHEMA
     SUPPORT: YES
     COMMENT: Performance Schema
TRANSACTIONS: NO
          XA: NO
  SAVEPOINTS: NO

mysql&gt; <strong class="userinput"><code>SHOW ENGINES\G</code></strong>
...
      Engine: PERFORMANCE_SCHEMA
     Support: YES
     Comment: Performance Schema
Transactions: NO
          XA: NO
  Savepoints: NO
...
</pre><p>
      The <a class="link" href="performance-schema.html" title="Chapter 25 MySQL Performance Schema"><code class="literal">PERFORMANCE_SCHEMA</code></a> storage engine
      operates on tables in the <code class="literal">performance_schema</code>
      database. You can make <code class="literal">performance_schema</code> the
      default database so that references to its tables need not be
      qualified with the database name:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>USE performance_schema;</code></strong>
</pre><p>
      Many examples in this chapter assume
      <code class="literal">performance_schema</code> as the default database.
    </p><p>
      Performance Schema tables are stored in the
      <code class="literal">performance_schema</code> database. Information about
      the structure of this database and its tables can be obtained, as
      for any other database, by selecting from the
      <code class="literal">INFORMATION_SCHEMA</code> database or by using
      <a class="link" href="sql-syntax.html#show" title="13.7.5 SHOW Syntax"><code class="literal">SHOW</code></a> statements. For example, use
      either of these statements to see what Performance Schema tables
      exist:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES</code></strong>
       <strong class="userinput"><code>WHERE TABLE_SCHEMA = 'performance_schema';</code></strong>
+------------------------------------------------------+
| TABLE_NAME                                           |
+------------------------------------------------------+
| accounts                                             |
| cond_instances                                       |
...
| events_stages_current                                |
| events_stages_history                                |
| events_stages_history_long                           |
| events_stages_summary_by_account_by_event_name       |
| events_stages_summary_by_host_by_event_name          |
| events_stages_summary_by_thread_by_event_name        |
| events_stages_summary_by_user_by_event_name          |
| events_stages_summary_global_by_event_name           |
| events_statements_current                            |
| events_statements_history                            |
| events_statements_history_long                       |
...
| file_instances                                       |
| file_summary_by_event_name                           |
| file_summary_by_instance                             |
| host_cache                                           |
| hosts                                                |
| memory_summary_by_account_by_event_name              |
| memory_summary_by_host_by_event_name                 |
| memory_summary_by_thread_by_event_name               |
| memory_summary_by_user_by_event_name                 |
| memory_summary_global_by_event_name                  |
| metadata_locks                                       |
| mutex_instances                                      |
| objects_summary_global_by_type                       |
| performance_timers                                   |
| replication_connection_configuration                 |
| replication_connection_status                        |
| replication_applier_configuration                    |
| replication_applier_status                           |
| replication_applier_status_by_coordinator            |
| replication_applier_status_by_worker                 |
| rwlock_instances                                     |
| session_account_connect_attrs                        |
| session_connect_attrs                                |
| setup_actors                                         |
| setup_consumers                                      |
| setup_instruments                                    |
| setup_objects                                        |
| setup_timers                                         |
| socket_instances                                     |
| socket_summary_by_event_name                         |
| socket_summary_by_instance                           |
| table_handles                                        |
| table_io_waits_summary_by_index_usage                |
| table_io_waits_summary_by_table                      |
| table_lock_waits_summary_by_table                    |
| threads                                              |
| users                                                |
+------------------------------------------------------+

mysql&gt; <strong class="userinput"><code>SHOW TABLES FROM performance_schema;</code></strong>
+------------------------------------------------------+
| Tables_in_performance_schema                         |
+------------------------------------------------------+
| accounts                                             |
| cond_instances                                       |
| events_stages_current                                |
| events_stages_history                                |
| events_stages_history_long                           |
...
</pre><p>
      The number of Performance Schema tables increases over time as
      implementation of additional instrumentation proceeds.
    </p><p>
      The name of the <code class="literal">performance_schema</code> database is
      lowercase, as are the names of tables within it. Queries should
      specify the names in lowercase.
    </p><p>
      To see the structure of individual tables, use
      <a class="link" href="sql-syntax.html#show-create-table" title="13.7.5.10 SHOW CREATE TABLE Syntax"><code class="literal">SHOW CREATE TABLE</code></a>:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SHOW CREATE TABLE setup_consumers\G</code></strong>
*************************** 1. row ***************************
       Table: setup_consumers
Create Table: CREATE TABLE `setup_consumers` (
  `NAME` varchar(64) NOT NULL,
  `ENABLED` enum('YES','NO') NOT NULL,
  PRIMARY KEY (`NAME`)
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
</pre><p>
      Table structure is also available by selecting from tables such as
      <a class="link" href="information-schema.html#columns-table" title="24.5 The INFORMATION_SCHEMA COLUMNS Table"><code class="literal">INFORMATION_SCHEMA.COLUMNS</code></a> or by
      using statements such as <a class="link" href="sql-syntax.html#show-columns" title="13.7.5.5 SHOW COLUMNS Syntax"><code class="literal">SHOW
      COLUMNS</code></a>.
    </p><p>
      Tables in the <code class="literal">performance_schema</code> database can
      be grouped according to the type of information in them: Current
      events, event histories and summaries, object instances, and setup
      (configuration) information. The following examples illustrate a
      few uses for these tables. For detailed information about the
      tables in each group, see
      <a class="xref" href="performance-schema.html#performance-schema-table-descriptions" title="25.11 Performance Schema Table Descriptions">Section 25.11, “Performance Schema Table Descriptions”</a>.
    </p><p>
      Initially, not all instruments and consumers are enabled, so the
      performance schema does not collect all events. To turn all of
      these on and enable event timing, execute two statements (the row
      counts may differ depending on MySQL version):
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments SET ENABLED = 'YES', TIMED = 'YES';</code></strong>
Query OK, 560 rows affected (0.04 sec)
mysql&gt; <strong class="userinput"><code>UPDATE setup_consumers SET ENABLED = 'YES';</code></strong>
Query OK, 10 rows affected (0.00 sec)
</pre><p>
      To see what the server is doing at the moment, examine the
      <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> table. It
      contains one row per thread showing each thread's most recent
      monitored event:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM events_waits_current\G</code></strong>
*************************** 1. row ***************************
            THREAD_ID: 0
             EVENT_ID: 5523
         END_EVENT_ID: 5523
           EVENT_NAME: wait/synch/mutex/mysys/THR_LOCK::mutex
               SOURCE: thr_lock.c:525
          TIMER_START: 201660494489586
            TIMER_END: 201660494576112
           TIMER_WAIT: 86526
                SPINS: NULL
        OBJECT_SCHEMA: NULL
          OBJECT_NAME: NULL
           INDEX_NAME: NULL
          OBJECT_TYPE: NULL
OBJECT_INSTANCE_BEGIN: 142270668
     NESTING_EVENT_ID: NULL
   NESTING_EVENT_TYPE: NULL
            OPERATION: lock
      NUMBER_OF_BYTES: NULL
                FLAGS: 0
...
</pre><p>
      This event indicates that thread 0 was waiting for 86,526
      picoseconds to acquire a lock on
      <code class="literal">THR_LOCK::mutex</code>, a mutex in the
      <code class="literal">mysys</code> subsystem. The first few columns provide
      the following information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          The ID columns indicate which thread the event comes from and
          the event number.
        </p></li><li class="listitem"><p>
          <code class="literal">EVENT_NAME</code> indicates what was instrumented
          and <code class="literal">SOURCE</code> indicates which source file
          contains the instrumented code.
        </p></li><li class="listitem"><p>
          The timer columns show when the event started and stopped and
          how long it took. If an event is still in progress, the
          <code class="literal">TIMER_END</code> and <code class="literal">TIMER_WAIT</code>
          values are <code class="literal">NULL</code>. Timer values are
          approximate and expressed in picoseconds. For information
          about timers and event time collection, see
          <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
</p></li></ul>
</div>
<p>
      The history tables contain the same kind of rows as the
      current-events table but have more rows and show what the server
      has been doing <span class="quote">“<span class="quote">recently</span>”</span> rather than
      <span class="quote">“<span class="quote">currently.</span>”</span> The
      <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a> and
      <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a> tables
      contain the most recent 10 events per thread and most recent
      10,000 events, respectively. For example, to see information for
      recent events produced by thread 13, do this:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT EVENT_ID, EVENT_NAME, TIMER_WAIT</code></strong>
       <strong class="userinput"><code>FROM events_waits_history WHERE THREAD_ID = 13</code></strong>
       <strong class="userinput"><code>ORDER BY EVENT_ID;</code></strong>
+----------+-----------------------------------------+------------+
| EVENT_ID | EVENT_NAME                              | TIMER_WAIT |
+----------+-----------------------------------------+------------+
|       86 | wait/synch/mutex/mysys/THR_LOCK::mutex  |     686322 |
|       87 | wait/synch/mutex/mysys/THR_LOCK_malloc  |     320535 |
|       88 | wait/synch/mutex/mysys/THR_LOCK_malloc  |     339390 |
|       89 | wait/synch/mutex/mysys/THR_LOCK_malloc  |     377100 |
|       90 | wait/synch/mutex/sql/LOCK_plugin        |     614673 |
|       91 | wait/synch/mutex/sql/LOCK_open          |     659925 |
|       92 | wait/synch/mutex/sql/THD::LOCK_thd_data |     494001 |
|       93 | wait/synch/mutex/mysys/THR_LOCK_malloc  |     222489 |
|       94 | wait/synch/mutex/mysys/THR_LOCK_malloc  |     214947 |
|       95 | wait/synch/mutex/mysys/LOCK_alarm       |     312993 |
+----------+-----------------------------------------+------------+
</pre><p>
      As new events are added to a history table, older events are
      discarded if the table is full.
    </p><p>
      Summary tables provide aggregated information for all events over
      time. The tables in this group summarize event data in different
      ways. To see which instruments have been executed the most times
      or have taken the most wait time, sort the
      <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_global_by_event_name</code></a>
      table on the <code class="literal">COUNT_STAR</code> or
      <code class="literal">SUM_TIMER_WAIT</code> column, which correspond to a
      <code class="literal">COUNT(*)</code> or <code class="literal">SUM(TIMER_WAIT)</code>
      value, respectively, calculated over all events:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT EVENT_NAME, COUNT_STAR</code></strong>
       <strong class="userinput"><code>FROM events_waits_summary_global_by_event_name</code></strong>
       <strong class="userinput"><code>ORDER BY COUNT_STAR DESC LIMIT 10;</code></strong>
+---------------------------------------------------+------------+
| EVENT_NAME                                        | COUNT_STAR |
+---------------------------------------------------+------------+
| wait/synch/mutex/mysys/THR_LOCK_malloc            |       6419 |
| wait/io/file/sql/FRM                              |        452 |
| wait/synch/mutex/sql/LOCK_plugin                  |        337 |
| wait/synch/mutex/mysys/THR_LOCK_open              |        187 |
| wait/synch/mutex/mysys/LOCK_alarm                 |        147 |
| wait/synch/mutex/sql/THD::LOCK_thd_data           |        115 |
| wait/io/file/myisam/kfile                         |        102 |
| wait/synch/mutex/sql/LOCK_global_system_variables |         89 |
| wait/synch/mutex/mysys/THR_LOCK::mutex            |         89 |
| wait/synch/mutex/sql/LOCK_open                    |         88 |
+---------------------------------------------------+------------+

mysql&gt; <strong class="userinput"><code>SELECT EVENT_NAME, SUM_TIMER_WAIT</code></strong>
       <strong class="userinput"><code>FROM events_waits_summary_global_by_event_name</code></strong>
       <strong class="userinput"><code>ORDER BY SUM_TIMER_WAIT DESC LIMIT 10;</code></strong>
+----------------------------------------+----------------+
| EVENT_NAME                             | SUM_TIMER_WAIT |
+----------------------------------------+----------------+
| wait/io/file/sql/MYSQL_LOG             |     1599816582 |
| wait/synch/mutex/mysys/THR_LOCK_malloc |     1530083250 |
| wait/io/file/sql/binlog_index          |     1385291934 |
| wait/io/file/sql/FRM                   |     1292823243 |
| wait/io/file/myisam/kfile              |      411193611 |
| wait/io/file/myisam/dfile              |      322401645 |
| wait/synch/mutex/mysys/LOCK_alarm      |      145126935 |
| wait/io/file/sql/casetest              |      104324715 |
| wait/synch/mutex/sql/LOCK_plugin       |       86027823 |
| wait/io/file/sql/pid                   |       72591750 |
+----------------------------------------+----------------+
</pre><p>
      These results show that the <code class="literal">THR_LOCK_malloc</code>
      mutex is <span class="quote">“<span class="quote">hot,</span>”</span> both in terms of how often it is used
      and amount of time that threads wait attempting to acquire it.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">

<div class="admon-title">
Note
</div>
<p>
        The <code class="literal">THR_LOCK_malloc</code> mutex is used only in
        debug builds. In production builds it is not hot because it is
        nonexistent.
</p>
</div>
<p>
      Instance tables document what types of objects are instrumented.
      An instrumented object, when used by the server, produces an
      event. These tables provide event names and explanatory notes or
      status information. For example, the
      <a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a> table lists instances
      of instruments for file I/O operations and their associated files:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM file_instances\G</code></strong>
*************************** 1. row ***************************
 FILE_NAME: /opt/mysql-log/60500/binlog.000007
EVENT_NAME: wait/io/file/sql/binlog
OPEN_COUNT: 0
*************************** 2. row ***************************
 FILE_NAME: /opt/mysql/60500/data/mysql/tables_priv.MYI
EVENT_NAME: wait/io/file/myisam/kfile
OPEN_COUNT: 1
*************************** 3. row ***************************
 FILE_NAME: /opt/mysql/60500/data/mysql/columns_priv.MYI
EVENT_NAME: wait/io/file/myisam/kfile
OPEN_COUNT: 1
...
</pre><p>
      Setup tables are used to configure and display monitoring
      characteristics. For example,
      <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> lists the set of
      instruments for which events can be collected and shows which of
      them are enabled:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments;</code></strong>
+---------------------------------------------------+---------+-------+
| NAME                                              | ENABLED | TIMED |
+---------------------------------------------------+---------+-------+
...
| stage/sql/end                                     | NO      | NO    |
| stage/sql/executing                               | NO      | NO    |
| stage/sql/init                                    | NO      | NO    |
| stage/sql/insert                                  | NO      | NO    |
...
| statement/sql/load                                | YES     | YES   |
| statement/sql/grant                               | YES     | YES   |
| statement/sql/check                               | YES     | YES   |
| statement/sql/flush                               | YES     | YES   |
...
| wait/synch/mutex/sql/LOCK_global_read_lock        | YES     | YES   |
| wait/synch/mutex/sql/LOCK_global_system_variables | YES     | YES   |
| wait/synch/mutex/sql/LOCK_lock_db                 | YES     | YES   |
| wait/synch/mutex/sql/LOCK_manager                 | YES     | YES   |
...
| wait/synch/rwlock/sql/LOCK_grant                  | YES     | YES   |
| wait/synch/rwlock/sql/LOGGER::LOCK_logger         | YES     | YES   |
| wait/synch/rwlock/sql/LOCK_sys_init_connect       | YES     | YES   |
| wait/synch/rwlock/sql/LOCK_sys_init_slave         | YES     | YES   |
...
| wait/io/file/sql/binlog                           | YES     | YES   |
| wait/io/file/sql/binlog_index                     | YES     | YES   |
| wait/io/file/sql/casetest                         | YES     | YES   |
| wait/io/file/sql/dbopt                            | YES     | YES   |
...
</pre><p>
      To understand how to interpret instrument names, see
      <a class="xref" href="performance-schema.html#performance-schema-instrument-naming" title="25.6 Performance Schema Instrument Naming Conventions">Section 25.6, “Performance Schema Instrument Naming Conventions”</a>.
    </p><p>
      To control whether events are collected for an instrument, set its
      <code class="literal">ENABLED</code> value to <code class="literal">YES</code> or
      <code class="literal">NO</code>. For example:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments SET ENABLED = 'NO'</code></strong>
       <strong class="userinput"><code>WHERE NAME = 'wait/synch/mutex/sql/LOCK_mysql_create_db';</code></strong>
</pre><p>
      The Performance Schema uses collected events to update tables in
      the <code class="literal">performance_schema</code> database, which act as
      <span class="quote">“<span class="quote">consumers</span>”</span> of event information. The
      <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table lists the
      available consumers and which are enabled:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| events_stages_current            | NO      |
| events_stages_history            | NO      |
| events_stages_history_long       | NO      |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | NO      |
| events_transactions_current      | NO      |
| events_transactions_history      | NO      |
| events_transactions_history_long | NO      |
| events_waits_current             | NO      |
| events_waits_history             | NO      |
| events_waits_history_long        | NO      |
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| statements_digest                | YES     |
+----------------------------------+---------+
</pre><p>
      To control whether the Performance Schema maintains a consumer as
      a destination for event information, set its
      <code class="literal">ENABLED</code> value.
    </p><p>
      For more information about the setup tables and how to use them to
      control event collection, see
      <a class="xref" href="performance-schema.html#performance-schema-filtering" title="25.4.2 Performance Schema Event Filtering">Section 25.4.2, “Performance Schema Event Filtering”</a>.
    </p><p>
      There are some miscellaneous tables that do not fall into any of
      the previous groups. For example,
      <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a> lists the
      available event timers and their characteristics. For information
      about timers, see <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-build-configuration"></a>25.2 Performance Schema Build Configuration</h2>

</div>

</div>

</div>
<p>
      The Performance Schema is mandatory and always compiled in. It is
      possible to exclude certain parts of the Performance Schema
      instrumentation. For example, to exclude stage and statement
      instrumentation, do this:
    </p><pre data-lang="terminal" class="programlisting">
shell&gt; <strong class="userinput"><code>cmake . \</code></strong>
        <strong class="userinput"><code>-DDISABLE_PSI_STAGE=1 \</code></strong>
        <strong class="userinput"><code>-DDISABLE_PSI_STATEMENT=1</code></strong>
</pre><p>
      For more information, see the descriptions of the
      <code class="literal">DISABLE_PSI_<em class="replaceable"><code>XXX</code></em></code>
      <span class="command"><strong>CMake</strong></span> options in
      <a class="xref" href="installing.html#source-configuration-options" title="2.9.4 MySQL Source-Configuration Options">Section 2.9.4, “MySQL Source-Configuration Options”</a>.
    </p><p>
      If you install MySQL over a previous installation that was
      configured without the Performance Schema (or with an older
      version of the Performance Schema that may not have all the
      current tables), run <a class="link" href="programs.html#mysql-upgrade" title="4.4.7 mysql_upgrade — Check and Upgrade MySQL Tables"><span class="command"><strong>mysql_upgrade</strong></span></a> after
      starting the server to ensure that the
      <code class="literal">performance_schema</code> database exists with all
      current tables. Then restart the server. One indication that you
      need to do this is the presence of messages such as the following
      in the error log:
    </p><pre data-lang="none" class="programlisting">
[ERROR] Native table 'performance_schema'.'events_waits_history'
has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_history_long'
has the wrong structure
...
</pre><p>
      To verify whether a server was built with Performance Schema
      support, check its help output. If the Performance Schema is
      available, the output will mention several variables with names
      that begin with <code class="literal">performance_schema</code>:
    </p><pre data-lang="terminal" class="programlisting">
shell&gt; <strong class="userinput"><code>mysqld --verbose --help</code></strong>
...
  --performance_schema
                      Enable the performance schema.
  --performance_schema_events_waits_history_long_size=#
                      Number of rows in events_waits_history_long.
...
</pre><p>
      You can also connect to the server and look for a line that names
      the <a class="link" href="performance-schema.html" title="Chapter 25 MySQL Performance Schema"><code class="literal">PERFORMANCE_SCHEMA</code></a> storage engine
      in the output from <a class="link" href="sql-syntax.html#show-engines" title="13.7.5.16 SHOW ENGINES Syntax"><code class="literal">SHOW ENGINES</code></a>:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SHOW ENGINES\G</code></strong>
...
      Engine: PERFORMANCE_SCHEMA
     Support: YES
     Comment: Performance Schema
Transactions: NO
          XA: NO
  Savepoints: NO
...
</pre><p>
      If the Performance Schema was not configured into the server at
      build time, no row for
      <a class="link" href="performance-schema.html" title="Chapter 25 MySQL Performance Schema"><code class="literal">PERFORMANCE_SCHEMA</code></a> will appear in the
      output from <a class="link" href="sql-syntax.html#show-engines" title="13.7.5.16 SHOW ENGINES Syntax"><code class="literal">SHOW ENGINES</code></a>. You might
      see <code class="literal">performance_schema</code> listed in the output
      from <a class="link" href="sql-syntax.html#show-databases" title="13.7.5.14 SHOW DATABASES Syntax"><code class="literal">SHOW DATABASES</code></a>, but it will
      have no tables and you will not be able to use it.
    </p><p>
      A line for <a class="link" href="performance-schema.html" title="Chapter 25 MySQL Performance Schema"><code class="literal">PERFORMANCE_SCHEMA</code></a> in the
      <a class="link" href="sql-syntax.html#show-engines" title="13.7.5.16 SHOW ENGINES Syntax"><code class="literal">SHOW ENGINES</code></a> output means that the
      Performance Schema is available, not that it is enabled. To enable
      it, you must do so at server startup, as described in the next
      section.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-startup-configuration"></a>25.3 Performance Schema Startup Configuration</h2>

</div>

</div>

</div>
<p>
      To use the MySQL Performance Schema, it must be enabled at server
      startup to enable event collection to occur.
    </p><p>
      Assuming that the Performance Schema is available, it is enabled
      by default. To enable or disable it explicitly, start the server
      with the <a class="link" href="performance-schema.html#sysvar_performance_schema"><code class="literal">performance_schema</code></a>
      variable set to an appropriate value. For example, use these lines
      in your <code class="filename">my.cnf</code> file:
    </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance_schema=ON
</pre><p>
      If the server is unable to allocate any internal buffer during
      Performance Schema initialization, the Performance Schema disables
      itself and sets
      <a class="link" href="performance-schema.html#sysvar_performance_schema"><code class="literal">performance_schema</code></a> to
      <code class="literal">OFF</code>, and the server runs without
      instrumentation.
    </p><p>
      The Performance Schema also permits instrument and consumer
      configuration at server startup.
    </p><p>
      To control an instrument at server startup, use an option of this
      form:
    </p><pre data-lang="terminal" class="programlisting">
--performance-schema-instrument='<em class="replaceable"><code>instrument_name</code></em>=<em class="replaceable"><code>value</code></em>'
</pre><p>
      Here, <em class="replaceable"><code>instrument_name</code></em> is an instrument
      name such as <code class="literal">wait/synch/mutex/sql/LOCK_open</code>,
      and <em class="replaceable"><code>value</code></em> is one of these values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          <code class="literal">OFF</code>, <code class="literal">FALSE</code>, or
          <code class="literal">0</code>: Disable the instrument
        </p></li><li class="listitem"><p>
          <code class="literal">ON</code>, <code class="literal">TRUE</code>, or
          <code class="literal">1</code>: Enable and time the instrument
        </p></li><li class="listitem"><p>
          <code class="literal">COUNTED</code>: Enable and count (rather than
          time) the instrument
</p></li></ul>
</div>
<p>
      Each
      <a class="link" href="performance-schema.html#option_mysqld_performance-schema-instrument"><code class="option">--performance-schema-instrument</code></a>
      option can specify only one instrument name, but multiple
      instances of the option can be given to configure multiple
      instruments. In addition, patterns are permitted in instrument
      names to configure instruments that match the pattern. To
      configure all condition synchronization instruments as enabled and
      counted, use this option:
    </p><pre data-lang="terminal" class="programlisting">
--performance-schema-instrument='wait/synch/cond/%=COUNTED'
</pre><p>
      To disable all instruments, use this option:
    </p><pre data-lang="terminal" class="programlisting">
--performance-schema-instrument='%=OFF'
</pre><p>
      Exception: The <code class="literal">memory/performance_schema/%</code>
      instruments are built in and cannot be disabled at startup.
    </p><p>
      Longer instrument name strings take precedence over shorter
      pattern names, regardless of order. For information about
      specifying patterns to select instruments, see
      <a class="xref" href="performance-schema.html#performance-schema-filtering-names" title="25.4.9 Naming Instruments or Consumers for Filtering Operations">Section 25.4.9, “Naming Instruments or Consumers for Filtering Operations”</a>.
    </p><p>
      An unrecognized instrument name is ignored. It is possible that a
      plugin installed later may create the instrument, at which time
      the name is recognized and configured.
    </p><p>
      To control a consumer at server startup, use an option of this
      form:
    </p><pre data-lang="terminal" class="programlisting">
--performance-schema-consumer-<em class="replaceable"><code>consumer_name</code></em>=<em class="replaceable"><code>value</code></em>
</pre><p>
      Here, <em class="replaceable"><code>consumer_name</code></em> is a consumer name
      such as <code class="literal">events_waits_history</code>, and
      <em class="replaceable"><code>value</code></em> is one of these values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          <code class="literal">OFF</code>, <code class="literal">FALSE</code>, or
          <code class="literal">0</code>: Do not collect events for the consumer
        </p></li><li class="listitem"><p>
          <code class="literal">ON</code>, <code class="literal">TRUE</code>, or
          <code class="literal">1</code>: Collect events for the consumer
</p></li></ul>
</div>
<p>
      For example, to enable the <code class="literal">events_waits_history</code>
      consumer, use this option:
    </p><pre data-lang="terminal" class="programlisting">
--performance-schema-consumer-events-waits-history=ON
</pre><p>
      The permitted consumer names can be found by examining the
      <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table. Patterns are
      not permitted. Consumer names in the
      <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table use
      underscores, but for consumers set at startup, dashes and
      underscores within the name are equivalent.
    </p><p>
      The Performance Schema includes several system variables that
      provide configuration information:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SHOW VARIABLES LIKE 'perf%';</code></strong>
+--------------------------------------------------------+---------+
| Variable_name                                          | Value   |
+--------------------------------------------------------+---------+
| performance_schema                                     | ON      |
| performance_schema_accounts_size                       | 100     |
| performance_schema_digests_size                        | 200     |
| performance_schema_events_stages_history_long_size     | 10000   |
| performance_schema_events_stages_history_size          | 10      |
| performance_schema_events_statements_history_long_size | 10000   |
| performance_schema_events_statements_history_size      | 10      |
| performance_schema_events_waits_history_long_size      | 10000   |
| performance_schema_events_waits_history_size           | 10      |
| performance_schema_hosts_size                          | 100     |
| performance_schema_max_cond_classes                    | 80      |
| performance_schema_max_cond_instances                  | 1000    |
...
</pre><p>
      The <a class="link" href="performance-schema.html#sysvar_performance_schema"><code class="literal">performance_schema</code></a> variable
      is <code class="literal">ON</code> or <code class="literal">OFF</code> to indicate
      whether the Performance Schema is enabled or disabled. The other
      variables indicate table sizes (number of rows) or memory
      allocation values.
</p><a class="indexterm" name="idm139684631711104"></a><a class="indexterm" name="idm139684631709616"></a>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">

<div class="admon-title">
Note
</div>
<p>
        With the Performance Schema enabled, the number of Performance
        Schema instances affects the server memory footprint, perhaps to
        a large extent. The Performance Schema autoscales many
        parameters to use memory only as required; see
        <a class="xref" href="performance-schema.html#performance-schema-memory-model" title="25.16 The Performance Schema Memory-Allocation Model">Section 25.16, “The Performance Schema Memory-Allocation Model”</a>.
</p>
</div>
<p>
      To change the value of Performance Schema system variables, set
      them at server startup. For example, put the following lines in a
      <code class="filename">my.cnf</code> file to change the sizes of the
      history tables for wait events:
    </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance_schema
performance_schema_events_waits_history_size=20
performance_schema_events_waits_history_long_size=15000
</pre><p>
      The Performance Schema automatically sizes the values of several
      of its parameters at server startup if they are not set
      explicitly. For example, it sizes the parameters that control the
      sizes of the events waits tables this way. the Performance Schema
      allocates memory incrementally, scaling its memory use to actual
      server load, instead of allocating all the memory it needs during
      server startup. Consequently, many sizing parameters need not be
      set at all. To see which parameters are autosized or autoscaled,
      use <a class="link" href="programs.html#mysqld" title="4.3.1 mysqld — The MySQL Server"><span class="command"><strong>mysqld --verbose --help</strong></span></a> and examine the
      option descriptions, or see
      <a class="xref" href="performance-schema.html#performance-schema-system-variables" title="25.14 Performance Schema System Variables">Section 25.14, “Performance Schema System Variables”</a>.
    </p><p>
      For each autosized parameter that is not set at server startup,
      the Performance Schema determines how to set its value based on
      the value of the following system values, which are considered as
      <span class="quote">“<span class="quote">hints</span>”</span> about how you have configured your MySQL
      server:
    </p><pre data-lang="none" class="programlisting">
max_connections
open_files_limit
table_definition_cache
table_open_cache
</pre><p>
      To override autosizing or autoscaling for a given parameter, set
      it to a value other than −1 at startup. In this case, the
      Performance Schema assigns it the specified value.
    </p><p>
      At runtime, <a class="link" href="sql-syntax.html#show-variables" title="13.7.5.39 SHOW VARIABLES Syntax"><code class="literal">SHOW VARIABLES</code></a> displays
      the actual values that autosized parameters were set to.
      Autoscaled parameters display with a value of −1.
    </p><p>
      If the Performance Schema is disabled, its autosized and
      autoscaled parameters remain set to −1 and
      <a class="link" href="sql-syntax.html#show-variables" title="13.7.5.39 SHOW VARIABLES Syntax"><code class="literal">SHOW VARIABLES</code></a> displays −1.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-runtime-configuration"></a>25.4 Performance Schema Runtime Configuration</h2>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#performance-schema-timing">25.4.1 Performance Schema Event Timing</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-filtering">25.4.2 Performance Schema Event Filtering</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-pre-filtering">25.4.3 Event Pre-Filtering</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-instrument-filtering">25.4.4 Pre-Filtering by Instrument</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-object-filtering">25.4.5 Pre-Filtering by Object</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-thread-filtering">25.4.6 Pre-Filtering by Thread</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-consumer-filtering">25.4.7 Pre-Filtering by Consumer</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-consumer-configurations">25.4.8 Example Consumer Configurations</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-filtering-names">25.4.9 Naming Instruments or Consumers for Filtering Operations</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-instrumentation-checking">25.4.10 Determining What Is Instrumented</a></span></dt></dl>
</div>
<p>
      Specific Performance Schema features can be enabled at runtime to
      control which types of event collection occur.
    </p><p>
      Performance Schema setup tables contain information about
      monitoring configuration:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES</code></strong>
       <strong class="userinput"><code>WHERE TABLE_SCHEMA = 'performance_schema'</code></strong>
       <strong class="userinput"><code>AND TABLE_NAME LIKE 'setup%';</code></strong>
+-------------------+
| TABLE_NAME        |
+-------------------+
| setup_actors      |
| setup_consumers   |
| setup_instruments |
| setup_objects     |
| setup_timers      |
+-------------------+
</pre><p>
      You can examine the contents of these tables to obtain information
      about Performance Schema monitoring characteristics. If you have
      the <a class="link" href="security.html#priv_update"><code class="literal">UPDATE</code></a> privilege, you can
      change Performance Schema operation by modifying setup tables to
      affect how monitoring occurs. For additional details about these
      tables, see <a class="xref" href="performance-schema.html#performance-schema-setup-tables" title="25.11.2 Performance Schema Setup Tables">Section 25.11.2, “Performance Schema Setup Tables”</a>.
    </p><p>
      To see which event timers are selected, query the
      <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> tables:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_timers;</code></strong>
+-------------+-------------+
| NAME        | TIMER_NAME  |
+-------------+-------------+
| idle        | MICROSECOND |
| wait        | CYCLE       |
| stage       | NANOSECOND  |
| statement   | NANOSECOND  |
| transaction | NANOSECOND  |
+-------------+-------------+
</pre><p>
      The <code class="literal">NAME</code> value indicates the type of instrument
      to which the timer applies, and <code class="literal">TIMER_NAME</code>
      indicates which timer applies to those instruments. The timer
      applies to instruments where their name begins with a component
      matching the <code class="literal">NAME</code> value.
    </p><p>
      To change the timer, update the <code class="literal">NAME</code> value. For
      example, to use the <code class="literal">NANOSECOND</code> timer for the
      <code class="literal">wait</code> timer:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_timers SET TIMER_NAME = 'NANOSECOND'</code></strong>
       <strong class="userinput"><code>WHERE NAME = 'wait';</code></strong>
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_timers;</code></strong>
+-------------+-------------+
| NAME        | TIMER_NAME  |
+-------------+-------------+
| idle        | MICROSECOND |
| wait        | NANOSECOND  |
| stage       | NANOSECOND  |
| statement   | NANOSECOND  |
| transaction | NANOSECOND  |
+-------------+-------------+
</pre><p>
      For discussion of timers, see
      <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
    </p><p>
      The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> and
      <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> tables list the
      instruments for which events can be collected and the types of
      consumers for which event information actually is collected,
      respectively. Other setup tables enable further modification of
      the monitoring configuration.
      <a class="xref" href="performance-schema.html#performance-schema-filtering" title="25.4.2 Performance Schema Event Filtering">Section 25.4.2, “Performance Schema Event Filtering”</a>, discusses how you
      can modify these tables to affect event collection.
    </p><p>
      If there are Performance Schema configuration changes that must be
      made at runtime using SQL statements and you would like these
      changes to take effect each time the server starts, put the
      statements in a file and start the server with the
      <a class="link" href="server-administration.html#option_mysqld_init-file"><code class="option">--init-file=<em class="replaceable"><code>file_name</code></em></code></a>
      option. This strategy can also be useful if you have multiple
      monitoring configurations, each tailored to produce a different
      kind of monitoring, such as casual server health monitoring,
      incident investigation, application behavior troubleshooting, and
      so forth. Put the statements for each monitoring configuration
      into their own file and specify the appropriate file as the
      <a class="link" href="server-administration.html#option_mysqld_init-file"><code class="option">--init-file</code></a> argument when you start
      the server.
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-timing"></a>25.4.1 Performance Schema Event Timing</h3>
</div>
</div>
</div>
<p>
        Events are collected by means of instrumentation added to the
        server source code. Instruments time events, which is how the
        Performance Schema provides an idea of how long events take. It
        is also possible to configure instruments not to collect timing
        information. This section discusses the available timers and
        their characteristics, and how timing values are represented in
        events.
</p>
<div class="simplesect">

<div class="titlepage">
<div>

<div class="simple">
<h4 class="title"><a name="performance-schema-timers"></a>Performance Schema Timers</h4>
</div>
</div>
</div>
<p>
          Two Performance Schema tables provide timer information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a> lists the
              available timers and their characteristics.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> indicates which
              timers are used for which instruments.
</p></li></ul>
</div>
<p>
          Each timer row in <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a>
          must refer to one of the timers listed in
          <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a>.
        </p><p>
          Timers vary in precision and amount of overhead. To see what
          timers are available and their characteristics, check the
          <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a> table:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM performance_timers;</code></strong>
+-------------+-----------------+------------------+----------------+
| TIMER_NAME  | TIMER_FREQUENCY | TIMER_RESOLUTION | TIMER_OVERHEAD |
+-------------+-----------------+------------------+----------------+
| CYCLE       |      2389029850 |                1 |             72 |
| NANOSECOND  |      1000000000 |                1 |            112 |
| MICROSECOND |         1000000 |                1 |            136 |
| MILLISECOND |            1036 |                1 |            168 |
| TICK        |             105 |                1 |           2416 |
+-------------+-----------------+------------------+----------------+
</pre><p>
          If the values associated with a given timer name are
          <code class="literal">NULL</code>, that timer is not supported on your
          platform. The rows that do not contain <code class="literal">NULL</code>
          indicate which timers you can use in
          <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a>.
        </p><p>
          The columns have these meanings:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              The <code class="literal">TIMER_NAME</code> column shows the names
              of the available timers. <code class="literal">CYCLE</code> refers
              to the timer that is based on the CPU (processor) cycle
              counter. The timers in
              <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> that you can use
              are those that do not have <code class="literal">NULL</code> in the
              other columns. If the values associated with a given timer
              name are <code class="literal">NULL</code>, that timer is not
              supported on your platform.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_FREQUENCY</code> indicates the number of
              timer units per second. For a cycle timer, the frequency
              is generally related to the CPU speed. The value shown was
              obtained on a system with a 2.4GHz processor. The other
              timers are based on fixed fractions of seconds. For
              <code class="literal">TICK</code>, the frequency may vary by
              platform (for example, some use 100 ticks/second, others
              1000 ticks/second).
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_RESOLUTION</code> indicates the number
              of timer units by which timer values increase at a time.
              If a timer has a resolution of 10, its value increases by
              10 each time.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_OVERHEAD</code> is the minimal number of
              cycles of overhead to obtain one timing with the given
              timer. The overhead per event is twice the value displayed
              because the timer is invoked at the beginning and end of
              the event.
</p></li></ul>
</div>
<p>
          To see which timers are in effect or to change timers, access
          the <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_timers;</code></strong>
+-------------+-------------+
| NAME        | TIMER_NAME  |
+-------------+-------------+
| idle        | MICROSECOND |
| wait        | CYCLE       |
| stage       | NANOSECOND  |
| statement   | NANOSECOND  |
| transaction | NANOSECOND  |
+-------------+-------------+

mysql&gt; <strong class="userinput"><code>UPDATE setup_timers SET TIMER_NAME = 'MICROSECOND'</code></strong>
       <strong class="userinput"><code>WHERE NAME = 'idle';</code></strong>
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_timers;</code></strong>
+-------------+-------------+
| NAME        | TIMER_NAME  |
+-------------+-------------+
| idle        | MICROSECOND |
| wait        | CYCLE       |
| stage       | NANOSECOND  |
| statement   | NANOSECOND  |
| transaction | NANOSECOND  |
+-------------+-------------+
</pre><p>
          By default, the Performance Schema uses the best timer
          available for each instrument type, but you can select a
          different one.
        </p><p>
          To time wait events, the most important criterion is to reduce
          overhead, at the possible expense of the timer accuracy, so
          using the <code class="literal">CYCLE</code> timer is the best.
        </p><p>
          The time a statement (or stage) takes to execute is in general
          orders of magnitude larger than the time it takes to execute a
          single wait. To time statements, the most important criterion
          is to have an accurate measure, which is not affected by
          changes in processor frequency, so using a timer which is not
          based on cycles is the best. The default timer for statements
          is <code class="literal">NANOSECOND</code>. The extra
          <span class="quote">“<span class="quote">overhead</span>”</span> compared to the
          <code class="literal">CYCLE</code> timer is not significant, because the
          overhead caused by calling a timer twice (once when the
          statement starts, once when it ends) is orders of magnitude
          less compared to the CPU time used to execute the statement
          itself. Using the <code class="literal">CYCLE</code> timer has no
          benefit here, only drawbacks.
        </p><p>
          The precision offered by the cycle counter depends on
          processor speed. If the processor runs at 1 GHz (one billion
          cycles/second) or higher, the cycle counter delivers
          sub-nanosecond precision. Using the cycle counter is much
          cheaper than getting the actual time of day. For example, the
          standard <code class="literal">gettimeofday()</code> function can take
          hundreds of cycles, which is an unacceptable overhead for data
          gathering that may occur thousands or millions of times per
          second.
        </p><p>
          Cycle counters also have disadvantages:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              End users expect to see timings in wall-clock units, such
              as fractions of a second. Converting from cycles to
              fractions of seconds can be expensive. For this reason,
              the conversion is a quick and fairly rough multiplication
              operation.
            </p></li><li class="listitem"><p>
              Processor cycle rate might change, such as when a laptop
              goes into power-saving mode or when a CPU slows down to
              reduce heat generation. If a processor's cycle rate
              fluctuates, conversion from cycles to real-time units is
              subject to error.
            </p></li><li class="listitem"><p>
              Cycle counters might be unreliable or unavailable
              depending on the processor or the operating system. For
              example, on Pentiums, the instruction is
              <code class="literal">RDTSC</code> (an assembly-language rather than
              a C instruction) and it is theoretically possible for the
              operating system to prevent user-mode programs from using
              it.
            </p></li><li class="listitem"><p>
              Some processor details related to out-of-order execution
              or multiprocessor synchronization might cause the counter
              to seem fast or slow by up to 1000 cycles.
</p></li></ul>
</div>
<p>
          MySQL works with cycle counters on x386 (Windows, macOS,
          Linux, Solaris, and other Unix flavors), PowerPC, and IA-64.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-timing-in-events"></a>Performance Schema Timer Representation in Events</h4>

</div>

</div>

</div>
<p>
          Rows in Performance Schema tables that store current events
          and historical events have three columns to represent timing
          information: <code class="literal">TIMER_START</code> and
          <code class="literal">TIMER_END</code> indicate when an event started
          and finished, and <code class="literal">TIMER_WAIT</code> indicates
          event duration.
        </p><p>
          The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table has
          an <code class="literal">ENABLED</code> column to indicate the
          instruments for which to collect events. The table also has a
          <code class="literal">TIMED</code> column to indicate which instruments
          are timed. If an instrument is not enabled, it produces no
          events. If an enabled instrument is not timed, events produced
          by the instrument have <code class="literal">NULL</code> for the
          <code class="literal">TIMER_START</code>, <code class="literal">TIMER_END</code>,
          and <code class="literal">TIMER_WAIT</code> timer values. This in turn
          causes those values to be ignored when calculating aggregate
          time values in summary tables (sum, minimum, maximum, and
          average).
        </p><p>
          Internally, times within events are stored in units given by
          the timer in effect when event timing begins. For display when
          events are retrieved from Performance Schema tables, times are
          shown in picoseconds (trillionths of a second) to normalize
          them to a standard unit, regardless of which timer is
          selected.
        </p><p>
          Modifications to the <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a>
          table affect monitoring immediately. Events already in
          progress may use the original timer for the begin time and the
          new timer for the end time. To avoid unpredictable results
          after you make timer changes, use
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> to reset
          Performance Schema statistics.
        </p><p>
          The timer baseline (<span class="quote">“<span class="quote">time zero</span>”</span>) occurs at
          Performance Schema initialization during server startup.
          <code class="literal">TIMER_START</code> and
          <code class="literal">TIMER_END</code> values in events represent
          picoseconds since the baseline. <code class="literal">TIMER_WAIT</code>
          values are durations in picoseconds.
        </p><p>
          Picosecond values in events are approximate. Their accuracy is
          subject to the usual forms of error associated with conversion
          from one unit to another. If the <code class="literal">CYCLE</code>
          timer is used and the processor rate varies, there might be
          drift. For these reasons, it is not reasonable to look at the
          <code class="literal">TIMER_START</code> value for an event as an
          accurate measure of time elapsed since server startup. On the
          other hand, it is reasonable to use
          <code class="literal">TIMER_START</code> or
          <code class="literal">TIMER_WAIT</code> values in <code class="literal">ORDER
          BY</code> clauses to order events by start time or
          duration.
        </p><p>
          The choice of picoseconds in events rather than a value such
          as microseconds has a performance basis. One implementation
          goal was to show results in a uniform time unit, regardless of
          the timer. In an ideal world this time unit would look like a
          wall-clock unit and be reasonably precise; in other words,
          microseconds. But to convert cycles or nanoseconds to
          microseconds, it would be necessary to perform a division for
          every instrumentation. Division is expensive on many
          platforms. Multiplication is not expensive, so that is what is
          used. Therefore, the time unit is an integer multiple of the
          highest possible <code class="literal">TIMER_FREQUENCY</code> value,
          using a multiplier large enough to ensure that there is no
          major precision loss. The result is that the time unit is
          <span class="quote">“<span class="quote">picoseconds.</span>”</span> This precision is spurious, but
          the decision enables overhead to be minimized.
        </p><p>
          While a wait, stage, statement, or transaction event is
          executing, the respective current-event tables display
          current-event timing information:
        </p><pre data-lang="none" class="programlisting">
events_waits_current
events_stages_current
events_statements_current
events_transactions_current
</pre><p>
          To make it possible to determine how how long a
          not-yet-completed event has been running, the timer columns
          are set as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">TIMER_START</code> is populated.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_END</code> is populated with the current
              timer value.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_WAIT</code> is populated with the time
              elapsed so far (<code class="literal">TIMER_END</code> −
              <code class="literal">TIMER_START</code>).
</p></li></ul>
</div>
<p>
          Events that have not yet completed have an
          <code class="literal">END_EVENT_ID</code> value of
          <code class="literal">NULL</code>. To assess time elapsed so far for an
          event, use the <code class="literal">TIMER_WAIT</code> column.
          Therefore, to identify events that have not yet completed and
          have taken longer than <em class="replaceable"><code>N</code></em>
          picoseconds thus far, monitoring applications can use this
          expression in queries:
        </p><pre data-lang="sql" class="programlisting">
WHERE END_EVENT_ID IS NULL AND TIMER_WAIT &gt; <em class="replaceable"><code>N</code></em>
</pre><p>
          Event identification as just described assumes that the
          corresponding instruments have <code class="literal">ENABLED</code> and
          <code class="literal">TIMED</code> set to <code class="literal">YES</code> and
          that the relevant consumers are enabled.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-filtering"></a>25.4.2 Performance Schema Event Filtering</h3>

</div>

</div>

</div>
<a class="indexterm" name="idm139684631571184"></a><a class="indexterm" name="idm139684631569696"></a><a class="indexterm" name="idm139684631568208"></a><p>
        Events are processed in a producer/consumer fashion:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Instrumented code is the source for events and produces
            events to be collected. The
            <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table lists
            the instruments for which events can be collected, whether
            they are enabled, and (for enabled instruments) whether to
            collect timing information:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments;</code></strong>
+---------------------------------------------------+---------+-------+
| NAME                                              | ENABLED | TIMED |
+---------------------------------------------------+---------+-------+
...
| wait/synch/mutex/sql/LOCK_global_read_lock        | YES     | YES   |
| wait/synch/mutex/sql/LOCK_global_system_variables | YES     | YES   |
| wait/synch/mutex/sql/LOCK_lock_db                 | YES     | YES   |
| wait/synch/mutex/sql/LOCK_manager                 | YES     | YES   |
...
</pre><p>
            The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table
            provides the most basic form of control over event
            production. To further refine event production based on the
            type of object or thread being monitored, other tables may
            be used as described in
            <a class="xref" href="performance-schema.html#performance-schema-pre-filtering" title="25.4.3 Event Pre-Filtering">Section 25.4.3, “Event Pre-Filtering”</a>.
          </p></li><li class="listitem"><p>
            Performance Schema tables are the destinations for events
            and consume events. The
            <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table lists the
            types of consumers to which event information can be sent
            and whether they are enabled:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| events_stages_current            | NO      |
| events_stages_history            | NO      |
| events_stages_history_long       | NO      |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | NO      |
| events_transactions_current      | NO      |
| events_transactions_history      | NO      |
| events_transactions_history_long | NO      |
| events_waits_current             | NO      |
| events_waits_history             | NO      |
| events_waits_history_long        | NO      |
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| statements_digest                | YES     |
+----------------------------------+---------+
</pre></li></ul>
</div>
<p>
        Filtering can be done at different stages of performance
        monitoring:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><b>Pre-filtering. </b>
              This is done by modifying Performance Schema configuration
              so that only certain types of events are collected from
              producers, and collected events update only certain
              consumers. To do this, enable or disable instruments or
              consumers. Pre-filtering is done by the Performance Schema
              and has a global effect that applies to all users.
            </p><p>
            Reasons to use pre-filtering:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                To reduce overhead. Performance Schema overhead should
                be minimal even with all instruments enabled, but
                perhaps you want to reduce it further. Or you do not
                care about timing events and want to disable the timing
                code to eliminate timing overhead.
              </p></li><li class="listitem"><p>
                To avoid filling the current-events or history tables
                with events in which you have no interest. Pre-filtering
                leaves more <span class="quote">“<span class="quote">room</span>”</span> in these tables for
                instances of rows for enabled instrument types. If you
                enable only file instruments with pre-filtering, no rows
                are collected for nonfile instruments. With
                post-filtering, nonfile events are collected, leaving
                fewer rows for file events.
              </p></li><li class="listitem"><p>
                To avoid maintaining some kinds of event tables. If you
                disable a consumer, the server does not spend time
                maintaining destinations for that consumer. For example,
                if you do not care about event histories, you can
                disable the history table consumers to improve
                performance.
</p></li></ul>
</div>
</li><li class="listitem"><p><b>Post-filtering. </b>
              This involves the use of <code class="literal">WHERE</code> clauses
              in queries that select information from Performance Schema
              tables, to specify which of the available events you want
              to see. Post-filtering is performed on a per-user basis
              because individual users select which of the available
              events are of interest.
            </p><p>
            Reasons to use post-filtering:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                To avoid making decisions for individual users about
                which event information is of interest.
              </p></li><li class="listitem"><p>
                To use the Performance Schema to investigate a
                performance issue when the restrictions to impose using
                pre-filtering are not known in advance.
</p></li></ul>
</div>
</li></ul>
</div>
<p>
        The following sections provide more detail about pre-filtering
        and provide guidelines for naming instruments or consumers in
        filtering operations. For information about writing queries to
        retrieve information (post-filtering), see
        <a class="xref" href="performance-schema.html#performance-schema-queries" title="25.5 Performance Schema Queries">Section 25.5, “Performance Schema Queries”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-pre-filtering"></a>25.4.3 Event Pre-Filtering</h3>

</div>

</div>

</div>
<p>
        Pre-filtering is done by the Performance Schema and has a global
        effect that applies to all users. Pre-filtering can be applied
        to either the producer or consumer stage of event processing:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            To configure pre-filtering at the producer stage, several
            tables can be used:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> indicates
                which instruments are available. An instrument disabled
                in this table produces no events regardless of the
                contents of the other production-related setup tables.
                An instrument enabled in this table is permitted to
                produce events, subject to the contents of the other
                tables.
              </p></li><li class="listitem"><p>
                <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> controls
                whether the Performance Schema monitors particular table
                and stored program objects.
              </p></li><li class="listitem"><p>
                <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> indicates whether
                monitoring is enabled for each server thread.
              </p></li><li class="listitem"><p>
                <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> determines the
                initial monitoring state for new foreground threads.
</p></li></ul>
</div>
</li><li class="listitem"><p>
            To configure pre-filtering at the consumer stage, modify the
            <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table. This
            determines the destinations to which events are sent.
            <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> also implicitly
            affects event production. If a given event will not be sent
            to any destination (that is, will not be consumed), the
            Performance Schema does not produce it.
</p></li></ul>
</div>
<p>
        Modifications to any of these tables affect monitoring
        immediately, with some exceptions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Modifications to some instruments in the
            <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table are
            effective only at server startup; changing them at runtime
            has no effect. This affects primarily mutexes, conditions,
            and rwlocks in the server, although there may be other
            instruments for which this is true. This restriction is
            lifted as of MySQL 5.7.12.
          </p></li><li class="listitem"><p>
            Modifications to the
            <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table affect only
            foreground threads created subsequent to the modification,
            not existing threads.
</p></li></ul>
</div>
<p>
        When you change the monitoring configuration, the Performance
        Schema does not flush the history tables. Events already
        collected remain in the current-events and history tables until
        displaced by newer events. If you disable instruments, you might
        need to wait a while before events for them are displaced by
        newer events of interest. Alternatively, use
        <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> to empty the
        history tables.
      </p><p>
        After making instrumentation changes, you might want to truncate
        the summary tables. Generally, the effect is to reset the
        summary columns to 0 or <code class="literal">NULL</code>, not to remove
        rows. This enables you to clear collected values and restart
        aggregation. That might be useful, for example, after you have
        made a runtime configuration change. Exceptions to this
        truncation behavior are noted in individual summary table
        sections.
      </p><p>
        The following sections describe how to use specific tables to
        control Performance Schema pre-filtering.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-instrument-filtering"></a>25.4.4 Pre-Filtering by Instrument</h3>

</div>

</div>

</div>
<p>
        The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table lists
        the available instruments:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments;</code></strong>
+---------------------------------------------------+---------+-------+
| NAME                                              | ENABLED | TIMED |
+---------------------------------------------------+---------+-------+
...
| stage/sql/end                                     | NO      | NO    |
| stage/sql/executing                               | NO      | NO    |
| stage/sql/init                                    | NO      | NO    |
| stage/sql/insert                                  | NO      | NO    |
...
| statement/sql/load                                | YES     | YES   |
| statement/sql/grant                               | YES     | YES   |
| statement/sql/check                               | YES     | YES   |
| statement/sql/flush                               | YES     | YES   |
...
| wait/synch/mutex/sql/LOCK_global_read_lock        | YES     | YES   |
| wait/synch/mutex/sql/LOCK_global_system_variables | YES     | YES   |
| wait/synch/mutex/sql/LOCK_lock_db                 | YES     | YES   |
| wait/synch/mutex/sql/LOCK_manager                 | YES     | YES   |
...
| wait/synch/rwlock/sql/LOCK_grant                  | YES     | YES   |
| wait/synch/rwlock/sql/LOGGER::LOCK_logger         | YES     | YES   |
| wait/synch/rwlock/sql/LOCK_sys_init_connect       | YES     | YES   |
| wait/synch/rwlock/sql/LOCK_sys_init_slave         | YES     | YES   |
...
| wait/io/file/sql/binlog                           | YES     | YES   |
| wait/io/file/sql/binlog_index                     | YES     | YES   |
| wait/io/file/sql/casetest                         | YES     | YES   |
| wait/io/file/sql/dbopt                            | YES     | YES   |
...
</pre><p>
        To control whether an instrument is enabled, set its
        <code class="literal">ENABLED</code> column to <code class="literal">YES</code> or
        <code class="literal">NO</code>. To configure whether to collect timing
        information for an enabled instrument, set its
        <code class="literal">TIMED</code> value to <code class="literal">YES</code> or
        <code class="literal">NO</code>. Setting the <code class="literal">TIMED</code>
        column affects Performance Schema table contents as described in
        <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
      </p><p>
        Modifications to most
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> rows affect
        monitoring immediately. For some instruments, modifications are
        effective only at server startup; changing them at runtime has
        no effect. This affects primarily mutexes, conditions, and
        rwlocks in the server, although there may be other instruments
        for which this is true.
      </p><p>
        The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table
        provides the most basic form of control over event production.
        To further refine event production based on the type of object
        or thread being monitored, other tables may be used as described
        in <a class="xref" href="performance-schema.html#performance-schema-pre-filtering" title="25.4.3 Event Pre-Filtering">Section 25.4.3, “Event Pre-Filtering”</a>.
      </p><p>
        The following examples demonstrate possible operations on the
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table. These
        changes, like other pre-filtering operations, affect all users.
        Some of these queries use the <a class="link" href="functions.html#operator_like"><code class="literal">LIKE</code></a>
        operator and a pattern match instrument names. For additional
        information about specifying patterns to select instruments, see
        <a class="xref" href="performance-schema.html#performance-schema-filtering-names" title="25.4.9 Naming Instruments or Consumers for Filtering Operations">Section 25.4.9, “Naming Instruments or Consumers for Filtering Operations”</a>.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Disable all instruments:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments SET ENABLED = 'NO';</code></strong>
</pre><p>
            Now no events will be collected.
          </p></li><li class="listitem"><p>
            Disable all file instruments, adding them to the current set
            of disabled instruments:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments SET ENABLED = 'NO'</code></strong>
       <strong class="userinput"><code>WHERE NAME LIKE 'wait/io/file/%';</code></strong>
</pre></li><li class="listitem"><p>
            Disable only file instruments, enable all other instruments:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments</code></strong>
       <strong class="userinput"><code>SET ENABLED = IF(NAME LIKE 'wait/io/file/%', 'NO', 'YES');</code></strong>
</pre></li><li class="listitem"><p>
            Enable all but those instruments in the
            <code class="literal">mysys</code> library:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments</code></strong>
       <strong class="userinput"><code>SET ENABLED = CASE WHEN NAME LIKE '%/mysys/%' THEN 'YES' ELSE 'NO' END;</code></strong>
</pre></li><li class="listitem"><p>
            Disable a specific instrument:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments SET ENABLED = 'NO'</code></strong>
       <strong class="userinput"><code>WHERE NAME = 'wait/synch/mutex/mysys/TMPDIR_mutex';</code></strong>
</pre></li><li class="listitem"><p>
            To toggle the state of an instrument, <span class="quote">“<span class="quote">flip</span>”</span>
            its <code class="literal">ENABLED</code> value:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments</code></strong>
       <strong class="userinput"><code>SET ENABLED = IF(ENABLED = 'YES', 'NO', 'YES')</code></strong>
       <strong class="userinput"><code>WHERE NAME = 'wait/synch/mutex/mysys/TMPDIR_mutex';</code></strong>
</pre></li><li class="listitem"><p>
            Disable timing for all events:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments SET TIMED = 'NO';</code></strong>
</pre></li></ul>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-object-filtering"></a>25.4.5 Pre-Filtering by Object</h3>

</div>

</div>

</div>
<p>
        The <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> table controls
        whether the Performance Schema monitors particular table and
        stored program objects. The initial
        <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> contents look like
        this:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_objects;</code></strong>
+-------------+--------------------+-------------+---------+-------+
| OBJECT_TYPE | OBJECT_SCHEMA      | OBJECT_NAME | ENABLED | TIMED |
+-------------+--------------------+-------------+---------+-------+
| EVENT       | mysql              | %           | NO      | NO    |
| EVENT       | performance_schema | %           | NO      | NO    |
| EVENT       | information_schema | %           | NO      | NO    |
| EVENT       | %                  | %           | YES     | YES   |
| FUNCTION    | mysql              | %           | NO      | NO    |
| FUNCTION    | performance_schema | %           | NO      | NO    |
| FUNCTION    | information_schema | %           | NO      | NO    |
| FUNCTION    | %                  | %           | YES     | YES   |
| PROCEDURE   | mysql              | %           | NO      | NO    |
| PROCEDURE   | performance_schema | %           | NO      | NO    |
| PROCEDURE   | information_schema | %           | NO      | NO    |
| PROCEDURE   | %                  | %           | YES     | YES   |
| TABLE       | mysql              | %           | NO      | NO    |
| TABLE       | performance_schema | %           | NO      | NO    |
| TABLE       | information_schema | %           | NO      | NO    |
| TABLE       | %                  | %           | YES     | YES   |
| TRIGGER     | mysql              | %           | NO      | NO    |
| TRIGGER     | performance_schema | %           | NO      | NO    |
| TRIGGER     | information_schema | %           | NO      | NO    |
| TRIGGER     | %                  | %           | YES     | YES   |
+-------------+--------------------+-------------+---------+-------+
</pre><p>
        Modifications to the <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>
        table affect object monitoring immediately.
      </p><p>
        The <code class="literal">OBJECT_TYPE</code> column indicates the type of
        object to which a row applies. <code class="literal">TABLE</code>
        filtering affects table I/O events
        (<code class="literal">wait/io/table/sql/handler</code> instrument) and
        table lock events
        (<code class="literal">wait/lock/table/sql/handler</code> instrument).
      </p><p>
        The <code class="literal">OBJECT_SCHEMA</code> and
        <code class="literal">OBJECT_NAME</code> columns should contain a literal
        schema or object name, or <code class="literal">'%'</code> to match any
        name.
      </p><p>
        The <code class="literal">ENABLED</code> column indicates whether matching
        objects are monitored, and <code class="literal">TIMED</code> indicates
        whether to collect timing information. Setting the
        <code class="literal">TIMED</code> column affects Performance Schema table
        contents as described in
        <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
      </p><p>
        The effect of the default object configuration is to instrument
        all objects except those in the <code class="literal">mysql</code>,
        <code class="literal">INFORMATION_SCHEMA</code>, and
        <code class="literal">performance_schema</code> databases. (Tables in the
        <code class="literal">INFORMATION_SCHEMA</code> database are not
        instrumented regardless of the contents of
        <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>; the row for
        <code class="literal">information_schema.%</code> simply makes this
        default explicit.)
      </p><p>
        When the Performance Schema checks for a match in
        <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>, it tries to find
        more specific matches first. For rows that match a given
        <code class="literal">OBJECT_TYPE</code>, the Performance Schema checks
        rows in this order:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Rows with
            <code class="literal">OBJECT_SCHEMA='<em class="replaceable"><code>literal</code></em>'</code>
            and
            <code class="literal">OBJECT_NAME='<em class="replaceable"><code>literal</code></em>'</code>.
          </p></li><li class="listitem"><p>
            Rows with
            <code class="literal">OBJECT_SCHEMA='<em class="replaceable"><code>literal</code></em>'</code>
            and <code class="literal">OBJECT_NAME='%'</code>.
          </p></li><li class="listitem"><p>
            Rows with <code class="literal">OBJECT_SCHEMA='%'</code> and
            <code class="literal">OBJECT_NAME='%'</code>.
</p></li></ul>
</div>
<p>
        For example, with a table <code class="literal">db1.t1</code>, the
        Performance Schema looks in <code class="literal">TABLE</code> rows for a
        match for <code class="literal">'db1'</code> and <code class="literal">'t1'</code>,
        then for <code class="literal">'db1'</code> and <code class="literal">'%'</code>,
        then for <code class="literal">'%'</code> and <code class="literal">'%'</code>. The
        order in which matching occurs matters because different
        matching <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> rows can
        have different <code class="literal">ENABLED</code> and
        <code class="literal">TIMED</code> values.
      </p><p>
        For table-related events, the Performance Schema combines the
        contents of <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> with
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> to determine
        whether to enable instruments and whether to time enabled
        instruments:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            For tables that match a row in
            <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>, table
            instruments produce events only if
            <code class="literal">ENABLED</code> is <code class="literal">YES</code> in both
            <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> and
            <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>.
          </p></li><li class="listitem"><p>
            The <code class="literal">TIMED</code> values in the two tables are
            combined, so that timing information is collected only when
            both values are <code class="literal">YES</code>.
</p></li></ul>
</div>
<p>
        For stored program objects, the Performance Schema takes the
        <code class="literal">ENABLED</code> and <code class="literal">TIMED</code> columns
        directly from the <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>
        row. There is no combining of values with
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a>.
      </p><p>
        Suppose that <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> contains
        the following <code class="literal">TABLE</code> rows that apply to
        <code class="literal">db1</code>, <code class="literal">db2</code>, and
        <code class="literal">db3</code>:
      </p><pre data-lang="sql" class="programlisting">
+-------------+---------------+-------------+---------+-------+
| OBJECT_TYPE | OBJECT_SCHEMA | OBJECT_NAME | ENABLED | TIMED |
+-------------+---------------+-------------+---------+-------+
| TABLE       | db1           | t1          | YES     | YES   |
| TABLE       | db1           | t2          | NO      | NO    |
| TABLE       | db2           | %           | YES     | YES   |
| TABLE       | db3           | %           | NO      | NO    |
| TABLE       | %             | %           | YES     | YES   |
+-------------+---------------+-------------+---------+-------+
</pre><p>
        If an object-related instrument in
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> has an
        <code class="literal">ENABLED</code> value of <code class="literal">NO</code>,
        events for the object are not monitored. If the
        <code class="literal">ENABLED</code> value is <code class="literal">YES</code>,
        event monitoring occurs according to the
        <code class="literal">ENABLED</code> value in the relevant
        <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> row:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">db1.t1</code> events are monitored
          </p></li><li class="listitem"><p>
            <code class="literal">db1.t2</code> events are not monitored
          </p></li><li class="listitem"><p>
            <code class="literal">db2.t3</code> events are monitored
          </p></li><li class="listitem"><p>
            <code class="literal">db3.t4</code> events are not monitored
          </p></li><li class="listitem"><p>
            <code class="literal">db4.t5</code> events are monitored
</p></li></ul>
</div>
<p>
        Similar logic applies for combining the <code class="literal">TIMED</code>
        columns from the <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a>
        and <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> tables to
        determine whether to collect event timing information.
      </p><p>
        If a persistent table and a temporary table have the same name,
        matching against <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> rows
        occurs the same way for both. It is not possible to enable
        monitoring for one table but not the other. However, each table
        is instrumented separately.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-thread-filtering"></a>25.4.6 Pre-Filtering by Thread</h3>

</div>

</div>

</div>
<p>
        The <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table contains a row
        for each server thread. Each row contains information about a
        thread and indicates whether monitoring is enabled for it. For
        the Performance Schema to monitor a thread, these things must be
        true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The <code class="literal">thread_instrumentation</code> consumer in
            the <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table must
            be <code class="literal">YES</code>.
          </p></li><li class="listitem"><p>
            The <code class="literal">threads.INSTRUMENTED</code> column must be
            <code class="literal">YES</code>.
          </p></li><li class="listitem"><p>
            Monitoring occurs only for those thread events produced from
            instruments that are enabled in the
            <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
</p></li></ul>
</div>
<p>
        The <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table also indicates
        for each server thread whether to perform historical event
        logging. This includes wait, stage, statement, and transaction
        events and affects logging to these tables:
      </p><pre data-lang="none" class="programlisting">
events_waits_history
events_waits_history_long
events_stages_history
events_stages_history_long
events_statements_history
events_statements_history_long
events_transactions_history
events_transactions_history_long
</pre><p>
        For historical event logging to occur, these things must be
        true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The appropriate history-related consumers in the
            <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table must be
            enabled. For example, wait event logging in the
            <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a> and
            <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>
            tables requires the corresponding
            <code class="literal">events_waits_history</code> and
            <code class="literal">events_waits_history_long</code> consumers to be
            <code class="literal">YES</code>.
          </p></li><li class="listitem"><p>
            The <code class="literal">threads.HISTORY</code> column must be
            <code class="literal">YES</code>.
          </p></li><li class="listitem"><p>
            Logging occurs only for those thread events produced from
            instruments that are enabled in the
            <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
</p></li></ul>
</div>
<p>
        For foreground threads (resulting from client connections), the
        initial values of the <code class="literal">INSTRUMENTED</code> and
        <code class="literal">HISTORY</code> columns in
        <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table rows are determined
        by whether the user account associated with a thread matches any
        row in the <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table. The
        values come from the <code class="literal">ENABLED</code> and
        <code class="literal">HISTORY</code> columns of the matching
        <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table row.
      </p><p>
        For background threads, there is no associated user.
        <code class="literal">INSTRUMENTED</code> and <code class="literal">HISTORY</code>
        are <code class="literal">YES</code> by default and
        <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> is not consulted.
      </p><p>
        The initial <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> contents
        look like this:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_actors;</code></strong>
+------+------+------+---------+---------+
| HOST | USER | ROLE | ENABLED | HISTORY |
+------+------+------+---------+---------+
| %    | %    | %    | YES     | YES     |
+------+------+------+---------+---------+
</pre><p>
        The <code class="literal">HOST</code> and <code class="literal">USER</code> columns
        should contain a literal host or user name, or
        <code class="literal">'%'</code> to match any name.
      </p><p>
        The <code class="literal">ENABLED</code> and <code class="literal">HISTORY</code>
        columns indicate whether to enable instrumentation and
        historical event logging for matching threads, subject to the
        other conditions described previously.
      </p><p>
        When the Performance Schema checks for a match for each new
        foreground thread in <code class="literal">setup_actors</code>, it tries
        to find more specific matches first, using the
        <code class="literal">USER</code> and <code class="literal">HOST</code> columns
        (<code class="literal">ROLE</code> is unused):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Rows with
            <code class="literal">USER='<em class="replaceable"><code>literal</code></em>'</code>
            and
            <code class="literal">HOST='<em class="replaceable"><code>literal</code></em>'</code>.
          </p></li><li class="listitem"><p>
            Rows with
            <code class="literal">USER='<em class="replaceable"><code>literal</code></em>'</code>
            and <code class="literal">HOST='%'</code>.
          </p></li><li class="listitem"><p>
            Rows with <code class="literal">USER='%'</code> and
            <code class="literal">HOST='<em class="replaceable"><code>literal</code></em>'</code>.
          </p></li><li class="listitem"><p>
            Rows with <code class="literal">USER='%'</code> and
            <code class="literal">HOST='%'</code>.
</p></li></ul>
</div>
<p>
        The order in which matching occurs matters because different
        matching <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> rows can have
        different <code class="literal">USER</code> and <code class="literal">HOST</code>
        values. This enables instrumenting and historical event logging
        to be applied selectively per host, user, or account (user and
        host combination), based on the <code class="literal">ENABLED</code> and
        <code class="literal">HISTORY</code> column values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            When the best match is a row with
            <code class="literal">ENABLED=YES</code>, the
            <code class="literal">INSTRUMENTED</code> value for the thread becomes
            <code class="literal">YES</code>. When the best match is a row with
            <code class="literal">HISTORY=YES</code>, the
            <code class="literal">HISTORY</code> value for the thread becomes
            <code class="literal">YES</code>.
          </p></li><li class="listitem"><p>
            When the best match is a row with
            <code class="literal">ENABLED=NO</code>, the
            <code class="literal">INSTRUMENTED</code> value for the thread becomes
            <code class="literal">NO</code>. When the best match is a row with
            <code class="literal">HISTORY=NO</code>, the
            <code class="literal">HISTORY</code> value for the thread becomes
            <code class="literal">NO</code>.
          </p></li><li class="listitem"><p>
            When no match is found, the <code class="literal">INSTRUMENTED</code>
            and <code class="literal">HISTORY</code> values for the thread become
            <code class="literal">NO</code>.
</p></li></ul>
</div>
<p>
        The <code class="literal">ENABLED</code> and <code class="literal">HISTORY</code>
        columns in <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> rows can be
        set to <code class="literal">YES</code> or <code class="literal">NO</code>
        independent of one another. This means you can enable
        instrumentation separately from whether you collect historical
        events.
      </p><p>
        By default, monitoring and historical event collection are
        enabled for all new foreground threads because the
        <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table initially
        contains a row with <code class="literal">'%'</code> for both
        <code class="literal">HOST</code> and <code class="literal">USER</code>. To perform
        more limited matching such as to enable monitoring only for some
        foreground threads, you must change this row because it matches
        any connection, and add rows for more specific
        <code class="literal">HOST</code>/<code class="literal">USER</code> combinations.
      </p><p>
        Suppose that you modify
        <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> as follows:
      </p><pre data-lang="sql" class="programlisting">
UPDATE setup_actors SET ENABLED = 'NO', HISTORY = 'NO'
WHERE HOST = '%' AND USER = '%';
INSERT INTO setup_actors (HOST,USER,ROLE,ENABLED,HISTORY)
VALUES('localhost','joe','%','YES','YES');
INSERT INTO setup_actors (HOST,USER,ROLE,ENABLED,HISTORY)
VALUES('hosta.example.com','joe','%','YES','NO');
INSERT INTO setup_actors (HOST,USER,ROLE,ENABLED,HISTORY)
VALUES('%','sam','%','NO','YES');
</pre><p>
        The <a class="link" href="sql-syntax.html#update" title="13.2.11 UPDATE Syntax"><code class="literal">UPDATE</code></a> statement changes the
        default match to disable instrumentation and historical event
        collection. The <a class="link" href="sql-syntax.html#insert" title="13.2.5 INSERT Syntax"><code class="literal">INSERT</code></a> statements
        add rows for more specific matches.
      </p><p>
        Now the Performance Schema determines how to set the
        <code class="literal">INSTRUMENTED</code> and <code class="literal">HISTORY</code>
        values for new connection threads as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            If <code class="literal">joe</code> connects from the local host, the
            connection matches the first inserted row. The
            <code class="literal">INSTRUMENTED</code> and
            <code class="literal">HISTORY</code> values for the thread become
            <code class="literal">YES</code>.
          </p></li><li class="listitem"><p>
            If <code class="literal">joe</code> connects from
            <code class="literal">hosta.example.com</code>, the connection matches
            the second inserted row. The <code class="literal">INSTRUMENTED</code>
            value for the thread becomes <code class="literal">YES</code> and the
            <code class="literal">HISTORY</code> value becomes
            <code class="literal">NO</code>.
          </p></li><li class="listitem"><p>
            If <code class="literal">joe</code> connects from any other host,
            there is no match. The <code class="literal">INSTRUMENTED</code> and
            <code class="literal">HISTORY</code> values for the thread become
            <code class="literal">NO</code>.
          </p></li><li class="listitem"><p>
            If <code class="literal">sam</code> connects from any host, the
            connection matches the third inserted row. The
            <code class="literal">INSTRUMENTED</code> value for the thread becomes
            <code class="literal">NO</code> and the <code class="literal">HISTORY</code>
            value becomes <code class="literal">YES</code>.
          </p></li><li class="listitem"><p>
            For any other connection, the row with
            <code class="literal">HOST</code> and <code class="literal">USER</code> set to
            <code class="literal">'%'</code> matches. This row now has
            <code class="literal">ENABLED</code> and <code class="literal">HISTORY</code>
            set to <code class="literal">NO</code>, so the
            <code class="literal">INSTRUMENTED</code> and
            <code class="literal">HISTORY</code> values for the thread become
            <code class="literal">NO</code>.
</p></li></ul>
</div>
<p>
        Modifications to the <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a>
        table affect only foreground threads created subsequent to the
        modification, not existing threads. To affect existing threads,
        modify the <code class="literal">INSTRUMENTED</code> and
        <code class="literal">HISTORY</code> columns of
        <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table rows.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-consumer-filtering"></a>25.4.7 Pre-Filtering by Consumer</h3>

</div>

</div>

</div>
<p>
        The <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table lists the
        available consumer types and which are enabled:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| events_stages_current            | NO      |
| events_stages_history            | NO      |
| events_stages_history_long       | NO      |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | NO      |
| events_transactions_current      | NO      |
| events_transactions_history      | NO      |
| events_transactions_history_long | NO      |
| events_waits_current             | NO      |
| events_waits_history             | NO      |
| events_waits_history_long        | NO      |
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| statements_digest                | YES     |
+----------------------------------+---------+
</pre><p>
        Modify the <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table to
        affect pre-filtering at the consumer stage and determine the
        destinations to which events are sent. To enable or disable a
        consumer, set its <code class="literal">ENABLED</code> value to
        <code class="literal">YES</code> or <code class="literal">NO</code>.
      </p><p>
        Modifications to the
        <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table affect
        monitoring immediately.
      </p><p>
        If you disable a consumer, the server does not spend time
        maintaining destinations for that consumer. For example, if you
        do not care about historical event information, disable the
        history consumers:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_consumers</code></strong>
       <strong class="userinput"><code>SET ENABLED = 'NO' WHERE NAME LIKE '%history%';</code></strong>
</pre><p>
        The consumer settings in the
        <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table form a
        hierarchy from higher levels to lower. The following principles
        apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Destinations associated with a consumer receive no events
            unless the Performance Schema checks the consumer and the
            consumer is enabled.
          </p></li><li class="listitem"><p>
            A consumer is checked only if all consumers it depends on
            (if any) are enabled.
          </p></li><li class="listitem"><p>
            If a consumer is not checked, or is checked but is disabled,
            other consumers that depend on it are not checked.
          </p></li><li class="listitem"><p>
            Dependent consumers may have their own dependent consumers.
          </p></li><li class="listitem"><p>
            If an event would not be sent to any destination, the
            Performance Schema does not produce it.
</p></li></ul>
</div>
<p>
        The following lists describe the available consumer values. For
        discussion of several representative consumer configurations and
        their effect on instrumentation, see
        <a class="xref" href="performance-schema.html#performance-schema-consumer-configurations" title="25.4.8 Example Consumer Configurations">Section 25.4.8, “Example Consumer Configurations”</a>.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-filtering-global-thread" title="Global and Thread Consumers">Global and Thread Consumers</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-filtering-wait-event" title="Wait Event Consumers">Wait Event Consumers</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-filtering-stage-event" title="Stage Event Consumers">Stage Event Consumers</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-filtering-statement-event" title="Statement Event Consumers">Statement Event Consumers</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-filtering-transaction-event" title="Transaction Event Consumers">Transaction Event Consumers</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-filtering-statement-digest" title="Statement Digest Consumer">Statement Digest Consumer</a></p></li></ul>
</div>

<div class="simplesect">

<div class="titlepage">
<div>

<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-filtering-global-thread"></a>Global and Thread Consumers</h4>

</div>

</div>

</div>

<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">global_instrumentation</code> is the highest
              level consumer. If
              <code class="literal">global_instrumentation</code> is
              <code class="literal">NO</code>, it disables global instrumentation.
              All other settings are lower level and are not checked; it
              does not matter what they are set to. No global or per
              thread information is maintained and no individual events
              are collected in the current-events or event-history
              tables. If <code class="literal">global_instrumentation</code> is
              <code class="literal">YES</code>, the Performance Schema maintains
              information for global states and also checks the
              <code class="literal">thread_instrumentation</code> consumer.
            </p></li><li class="listitem"><p>
              <code class="literal">thread_instrumentation</code> is checked only
              if <code class="literal">global_instrumentation</code> is
              <code class="literal">YES</code>. Otherwise, if
              <code class="literal">thread_instrumentation</code> is
              <code class="literal">NO</code>, it disables thread-specific
              instrumentation and all lower-level settings are ignored.
              No information is maintained per thread and no individual
              events are collected in the current-events or
              event-history tables. If
              <code class="literal">thread_instrumentation</code> is
              <code class="literal">YES</code>, the Performance Schema maintains
              thread-specific information and also checks
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_current</code>
              consumers.
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-filtering-wait-event"></a>Wait Event Consumers</h4>

</div>

</div>

</div>
<p>
          These consumers require both
          <code class="literal">global_instrumentation</code> and
          <code class="literal">thread_instrumentation</code> to be
          <code class="literal">YES</code> or they are not checked. If checked,
          they act as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">events_waits_current</code>, if
              <code class="literal">NO</code>, disables collection of individual
              wait events in the
              <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> table.
              If <code class="literal">YES</code>, it enables wait event
              collection and the Performance Schema checks the
              <code class="literal">events_waits_history</code> and
              <code class="literal">events_waits_history_long</code> consumers.
            </p></li><li class="listitem"><p>
              <code class="literal">events_waits_history</code> is not checked if
              <code class="literal">event_waits_current</code> is
              <code class="literal">NO</code>. Otherwise, an
              <code class="literal">events_waits_history</code> value of
              <code class="literal">NO</code> or <code class="literal">YES</code> disables
              or enables collection of wait events in the
              <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a> table.
            </p></li><li class="listitem"><p>
              <code class="literal">events_waits_history_long</code> is not
              checked if <code class="literal">event_waits_current</code> is
              <code class="literal">NO</code>. Otherwise, an
              <code class="literal">events_waits_history_long</code> value of
              <code class="literal">NO</code> or <code class="literal">YES</code> disables
              or enables collection of wait events in the
              <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>
              table.
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-filtering-stage-event"></a>Stage Event Consumers</h4>

</div>

</div>

</div>
<p>
          These consumers require both
          <code class="literal">global_instrumentation</code> and
          <code class="literal">thread_instrumentation</code> to be
          <code class="literal">YES</code> or they are not checked. If checked,
          they act as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">events_stages_current</code>, if
              <code class="literal">NO</code>, disables collection of individual
              stage events in the
              <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a> table.
              If <code class="literal">YES</code>, it enables stage event
              collection and the Performance Schema checks the
              <code class="literal">events_stages_history</code> and
              <code class="literal">events_stages_history_long</code> consumers.
            </p></li><li class="listitem"><p>
              <code class="literal">events_stages_history</code> is not checked if
              <code class="literal">event_stages_current</code> is
              <code class="literal">NO</code>. Otherwise, an
              <code class="literal">events_stages_history</code> value of
              <code class="literal">NO</code> or <code class="literal">YES</code> disables
              or enables collection of stage events in the
              <a class="link" href="performance-schema.html#events-stages-history-table" title="25.11.5.2 The events_stages_history Table"><code class="literal">events_stages_history</code></a> table.
            </p></li><li class="listitem"><p>
              <code class="literal">events_stages_history_long</code> is not
              checked if <code class="literal">event_stages_current</code> is
              <code class="literal">NO</code>. Otherwise, an
              <code class="literal">events_stages_history_long</code> value of
              <code class="literal">NO</code> or <code class="literal">YES</code> disables
              or enables collection of stage events in the
              <a class="link" href="performance-schema.html#events-stages-history-long-table" title="25.11.5.3 The events_stages_history_long Table"><code class="literal">events_stages_history_long</code></a>
              table.
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-filtering-statement-event"></a>Statement Event Consumers</h4>

</div>

</div>

</div>
<p>
          These consumers require both
          <code class="literal">global_instrumentation</code> and
          <code class="literal">thread_instrumentation</code> to be
          <code class="literal">YES</code> or they are not checked. If checked,
          they act as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">events_statements_current</code>, if
              <code class="literal">NO</code>, disables collection of individual
              statement events in the
              <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>
              table. If <code class="literal">YES</code>, it enables statement
              event collection and the Performance Schema checks the
              <code class="literal">events_statements_history</code> and
              <code class="literal">events_statements_history_long</code>
              consumers.
            </p></li><li class="listitem"><p>
              <code class="literal">events_statements_history</code> is not
              checked if <code class="literal">events_statements_current</code> is
              <code class="literal">NO</code>. Otherwise, an
              <code class="literal">events_statements_history</code> value of
              <code class="literal">NO</code> or <code class="literal">YES</code> disables
              or enables collection of statement events in the
              <a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a>
              table.
            </p></li><li class="listitem"><p>
              <code class="literal">events_statements_history_long</code> is not
              checked if <code class="literal">events_statements_current</code> is
              <code class="literal">NO</code>. Otherwise, an
              <code class="literal">events_statements_history_long</code> value of
              <code class="literal">NO</code> or <code class="literal">YES</code> disables
              or enables collection of statement events in the
              <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>
              table.
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-filtering-transaction-event"></a>Transaction Event Consumers</h4>

</div>

</div>

</div>
<p>
          These consumers require both
          <code class="literal">global_instrumentation</code> and
          <code class="literal">thread_instrumentation</code> to be
          <code class="literal">YES</code> or they are not checked. If checked,
          they act as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">events_transactions_current</code>, if
              <code class="literal">NO</code>, disables collection of individual
              transaction events in the
              <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>
              table. If <code class="literal">YES</code>, it enables transaction
              event collection and the Performance Schema checks the
              <code class="literal">events_transactions_history</code> and
              <code class="literal">events_transactions_history_long</code>
              consumers.
            </p></li><li class="listitem"><p>
              <code class="literal">events_transactions_history</code> is not
              checked if <code class="literal">events_transactions_current</code>
              is <code class="literal">NO</code>. Otherwise, an
              <code class="literal">events_transactions_history</code> value of
              <code class="literal">NO</code> or <code class="literal">YES</code> disables
              or enables collection of transaction events in the
              <a class="link" href="performance-schema.html#events-transactions-history-table" title="25.11.7.2 The events_transactions_history Table"><code class="literal">events_transactions_history</code></a>
              table.
            </p></li><li class="listitem"><p>
              <code class="literal">events_transactions_history_long</code> is not
              checked if <code class="literal">events_transactions_current</code>
              is <code class="literal">NO</code>. Otherwise, an
              <code class="literal">events_transactions_history_long</code> value
              of <code class="literal">NO</code> or <code class="literal">YES</code>
              disables or enables collection of transaction events in
              the
              <a class="link" href="performance-schema.html#events-transactions-history-long-table" title="25.11.7.3 The events_transactions_history_long Table"><code class="literal">events_transactions_history_long</code></a>
              table.
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-filtering-statement-digest"></a>Statement Digest Consumer</h4>

</div>

</div>

</div>
<p>
          The <code class="literal">statements_digest</code> consumer requires
          <code class="literal">global_instrumentation</code> to be
          <code class="literal">YES</code> or it is not checked. There is no
          dependency on the statement event consumers, so you can obtain
          statistics per digest without having to collect statistics in
          <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>, which
          is advantageous in terms of overhead. Conversely, you can get
          detailed statements in
          <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a> without
          digests (the <code class="literal">DIGEST</code> and
          <code class="literal">DIGEST_TEXT</code> columns will be
          <code class="literal">NULL</code>).
        </p><p>
          For more information about statement digesting, see
          <a class="xref" href="performance-schema.html#performance-schema-statement-digests" title="25.9 Performance Schema Statement Digests">Section 25.9, “Performance Schema Statement Digests”</a>.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-consumer-configurations"></a>25.4.8 Example Consumer Configurations</h3>

</div>

</div>

</div>
<p>
        The consumer settings in the
        <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table form a
        hierarchy from higher levels to lower. The following discussion
        describes how consumers work, showing specific configurations
        and their effects as consumer settings are enabled progressively
        from high to low. The consumer values shown are representative.
        The general principles described here apply to other consumer
        values that may be available.
      </p><p>
        The configuration descriptions occur in order of increasing
        functionality and overhead. If you do not need the information
        provided by enabling lower-level settings, disable them and the
        Performance Schema will execute less code on your behalf and you
        will have less information to sift through.
      </p><p>
        The <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table contains
        the following hierarchy of values:
      </p><pre data-lang="none" class="programlisting">
global_instrumentation
 thread_instrumentation
   events_waits_current
     events_waits_history
     events_waits_history_long
   events_stages_current
     events_stages_history
     events_stages_history_long
   events_statements_current
     events_statements_history
     events_statements_history_long
   events_transactions_current
     events_transactions_history
     events_transactions_history_long
 statements_digest
</pre>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">

<div class="admon-title">
Note
</div>
<p>
          In the consumer hierarchy, the consumers for waits, stages,
          statements, and transactions are all at the same level. This
          differs from the event nesting hierarchy, for which wait
          events nest within stage events, which nest within statement
          events, which nest within transaction events.
</p>
</div>
<p>
        If a given consumer setting is <code class="literal">NO</code>, the
        Performance Schema disables the instrumentation associated with
        the consumer and ignores all lower-level settings. If a given
        setting is <code class="literal">YES</code>, the Performance Schema
        enables the instrumentation associated with it and checks the
        settings at the next lowest level. For a description of the
        rules for each consumer, see
        <a class="xref" href="performance-schema.html#performance-schema-consumer-filtering" title="25.4.7 Pre-Filtering by Consumer">Section 25.4.7, “Pre-Filtering by Consumer”</a>.
      </p><p>
        For example, if <code class="literal">global_instrumentation</code> is
        enabled, <code class="literal">thread_instrumentation</code> is checked.
        If <code class="literal">thread_instrumentation</code> is enabled, the
        <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_current</code>
        consumers are checked. If of these
        <code class="literal">events_waits_current</code> is enabled,
        <code class="literal">events_waits_history</code> and
        <code class="literal">events_waits_history_long</code> are checked.
      </p><p>
        Each of the following configuration descriptions indicates which
        setup elements the Performance Schema checks and which output
        tables it maintains (that is, for which tables it collects
        information).
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-configurations-no-instrumentation" title="No Instrumentation">No Instrumentation</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-configurations-global-instrumentation-only" title="Global Instrumentation Only">Global Instrumentation Only</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-configurations-global-and-thread-instrumentation-only" title="Global and Thread Instrumentation Only">Global and Thread Instrumentation Only</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-configurations-global-thread-and-current-event-instrumentation" title="Global, Thread, and Current-Event Instrumentation">Global, Thread, and Current-Event Instrumentation</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-consumer-configurations-global-thread-current-event-and-event-history-instrumentation" title="Global, Thread, Current-Event, and Event-History instrumentation">Global, Thread, Current-Event, and Event-History instrumentation</a></p></li></ul>
</div>

<div class="simplesect">

<div class="titlepage">
<div>

<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-configurations-no-instrumentation"></a>No Instrumentation</h4>

</div>

</div>

</div>
<p>
          Server configuration state:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+---------------------------+---------+
| NAME                      | ENABLED |
+---------------------------+---------+
| global_instrumentation    | NO      |
...
+---------------------------+---------+
</pre><p>
          In this configuration, nothing is instrumented.
        </p><p>
          Setup elements checked:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Table <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a>,
              consumer <code class="literal">global_instrumentation</code>
</p></li></ul>
</div>
<p>
          Output tables maintained:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              None
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-configurations-global-instrumentation-only"></a>Global Instrumentation Only</h4>

</div>

</div>

</div>
<p>
          Server configuration state:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+---------------------------+---------+
| NAME                      | ENABLED |
+---------------------------+---------+
| global_instrumentation    | YES     |
| thread_instrumentation    | NO      |
...
+---------------------------+---------+
</pre><p>
          In this configuration, instrumentation is maintained only for
          global states. Per-thread instrumentation is disabled.
        </p><p>
          Additional setup elements checked, relative to the preceding
          configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Table <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a>,
              consumer <code class="literal">thread_instrumentation</code>
            </p></li><li class="listitem"><p>
              Table <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a>
            </p></li><li class="listitem"><p>
              Table <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>
            </p></li><li class="listitem"><p>
              Table <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a>
</p></li></ul>
</div>
<p>
          Additional output tables maintained, relative to the preceding
          configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#rwlock-instances-table" title="25.11.3.4 The rwlock_instances Table"><code class="literal">rwlock_instances</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#cond-instances-table" title="25.11.3.1 The cond_instances Table"><code class="literal">cond_instances</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_event_name</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#file-summary-tables" title="25.11.15.6 File I/O Summary Tables"><code class="literal">file_summary_by_instance</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#file-summary-tables" title="25.11.15.6 File I/O Summary Tables"><code class="literal">file_summary_by_event_name</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#objects-summary-global-by-type-table" title="25.11.15.5 Object Wait Summary Table"><code class="literal">objects_summary_global_by_type</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_global_by_event_name</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#table-lock-waits-summary-by-table-table" title="25.11.15.7.3 The table_lock_waits_summary_by_table Table"><code class="literal">table_lock_waits_summary_by_table</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#table-io-waits-summary-by-index-usage-table" title="25.11.15.7.2 The table_io_waits_summary_by_index_usage Table"><code class="literal">table_io_waits_summary_by_index_usage</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#table-io-waits-summary-by-table-table" title="25.11.15.7.1 The table_io_waits_summary_by_table Table"><code class="literal">table_io_waits_summary_by_table</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_by_instance</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_global_by_event_name</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_global_by_event_name</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_global_by_event_name</code></a>
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_global_by_event_name</code></a>
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-configurations-global-and-thread-instrumentation-only"></a>Global and Thread Instrumentation Only</h4>

</div>

</div>

</div>
<p>
          Server configuration state:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | NO      |
...
| events_stages_current            | NO      |
...
| events_statements_current        | NO      |
...
| events_transactions_current      | NO      |
...
+----------------------------------+---------+
</pre><p>
          In this configuration, instrumentation is maintained globally
          and per thread. No individual events are collected in the
          current-events or event-history tables.
        </p><p>
          Additional setup elements checked, relative to the preceding
          configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Table <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a>,
              consumers
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_current</code>,
              where <em class="replaceable"><code>xxx</code></em> is
              <code class="literal">waits</code>, <code class="literal">stages</code>,
              <code class="literal">statements</code>,
              <code class="literal">transactions</code>
            </p></li><li class="listitem"><p>
              Table <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a>
            </p></li><li class="listitem"><p>
              Column <code class="literal">threads.instrumented</code>
</p></li></ul>
</div>
<p>
          Additional output tables maintained, relative to the preceding
          configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_summary_by_<em class="replaceable"><code>yyy</code></em>_by_event_name</code>,
              where <em class="replaceable"><code>xxx</code></em> is
              <code class="literal">waits</code>, <code class="literal">stages</code>,
              <code class="literal">statements</code>,
              <code class="literal">transactions</code>; and
              <em class="replaceable"><code>yyy</code></em> is
              <code class="literal">thread</code>, <code class="literal">user</code>,
              <code class="literal">host</code>, <code class="literal">account</code>
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-configurations-global-thread-and-current-event-instrumentation"></a>Global, Thread, and Current-Event Instrumentation</h4>

</div>

</div>

</div>
<p>
          Server configuration state:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | YES     |
| events_waits_history             | NO      |
| events_waits_history_long        | NO      |
| events_stages_current            | YES     |
| events_stages_history            | NO      |
| events_stages_history_long       | NO      |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | NO      |
| events_transactions_current      | YES     |
| events_transactions_history      | YES     |
| events_transactions_history_long | NO      |
...
+----------------------------------+---------+
</pre><p>
          In this configuration, instrumentation is maintained globally
          and per thread. Individual events are collected in the
          current-events table, but not in the event-history tables.
        </p><p>
          Additional setup elements checked, relative to the preceding
          configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Consumers
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_history</code>,
              where <em class="replaceable"><code>xxx</code></em> is
              <code class="literal">waits</code>, <code class="literal">stages</code>,
              <code class="literal">statements</code>,
              <code class="literal">transactions</code>
            </p></li><li class="listitem"><p>
              Consumers
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_history_long</code>,
              where <em class="replaceable"><code>xxx</code></em> is
              <code class="literal">waits</code>, <code class="literal">stages</code>,
              <code class="literal">statements</code>,
              <code class="literal">transactions</code>
</p></li></ul>
</div>
<p>
          Additional output tables maintained, relative to the preceding
          configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_current</code>,
              where <em class="replaceable"><code>xxx</code></em> is
              <code class="literal">waits</code>, <code class="literal">stages</code>,
              <code class="literal">statements</code>,
              <code class="literal">transactions</code>
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title"><a name="performance-schema-consumer-configurations-global-thread-current-event-and-event-history-instrumentation"></a>Global, Thread, Current-Event, and Event-History instrumentation</h4>

</div>

</div>

</div>
<p>
          The preceding configuration collects no event history because
          the
          <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_history</code>
          and
          <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_history_long</code>
          consumers are disabled. Those consumers can be enabled
          separately or together to collect event history per thread,
          globally, or both.
        </p><p>
          This configuration collects event history per thread, but not
          globally:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | YES     |
| events_waits_history             | YES     |
| events_waits_history_long        | NO      |
| events_stages_current            | YES     |
| events_stages_history            | YES     |
| events_stages_history_long       | NO      |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | NO      |
| events_transactions_current      | YES     |
| events_transactions_history      | YES     |
| events_transactions_history_long | NO      |
...
+----------------------------------+---------+
</pre><p>
          Event-history tables maintained for this configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_history</code>,
              where <em class="replaceable"><code>xxx</code></em> is
              <code class="literal">waits</code>, <code class="literal">stages</code>,
              <code class="literal">statements</code>,
              <code class="literal">transactions</code>
</p></li></ul>
</div>
<p>
          This configuration collects event history globally, but not
          per thread:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | YES     |
| events_waits_history             | NO      |
| events_waits_history_long        | YES     |
| events_stages_current            | YES     |
| events_stages_history            | NO      |
| events_stages_history_long       | YES     |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | YES     |
| events_transactions_current      | YES     |
| events_transactions_history      | YES     |
| events_transactions_history_long | YES     |
...
+----------------------------------+---------+
</pre><p>
          Event-history tables maintained for this configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_history_long</code>,
              where <em class="replaceable"><code>xxx</code></em> is
              <code class="literal">waits</code>, <code class="literal">stages</code>,
              <code class="literal">statements</code>,
              <code class="literal">transactions</code>
</p></li></ul>
</div>
<p>
          This configuration collects event history per thread and
          globally:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | YES     |
| events_waits_history             | YES     |
| events_waits_history_long        | YES     |
| events_stages_current            | YES     |
| events_stages_history            | YES     |
| events_stages_history_long       | YES     |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | YES     |
| events_transactions_current      | YES     |
| events_transactions_history      | YES     |
| events_transactions_history_long | YES     |
...
+----------------------------------+---------+
</pre><p>
          Event-history tables maintained for this configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_history</code>,
              where <em class="replaceable"><code>xxx</code></em> is
              <code class="literal">waits</code>, <code class="literal">stages</code>,
              <code class="literal">statements</code>,
              <code class="literal">transactions</code>
            </p></li><li class="listitem"><p>
              <code class="literal">events_<em class="replaceable"><code>xxx</code></em>_history_long</code>,
              where <em class="replaceable"><code>xxx</code></em> is
              <code class="literal">waits</code>, <code class="literal">stages</code>,
              <code class="literal">statements</code>,
              <code class="literal">transactions</code>
</p></li></ul>
</div>

</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-filtering-names"></a>25.4.9 Naming Instruments or Consumers for Filtering Operations</h3>

</div>

</div>

</div>
<p>
        Names given for filtering operations can be as specific or
        general as required. To indicate a single instrument or
        consumer, specify its name in full:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments</code></strong>
       <strong class="userinput"><code>SET ENABLED = 'NO'</code></strong>
       <strong class="userinput"><code>WHERE NAME = 'wait/synch/mutex/myisammrg/MYRG_INFO::mutex';</code></strong>

mysql&gt; <strong class="userinput"><code>UPDATE setup_consumers</code></strong>
       <strong class="userinput"><code>SET ENABLED = 'NO' WHERE NAME = 'events_waits_current';</code></strong>
</pre><p>
        To specify a group of instruments or consumers, use a pattern
        that matches the group members:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments</code></strong>
       <strong class="userinput"><code>SET ENABLED = 'NO'</code></strong>
       <strong class="userinput"><code>WHERE NAME LIKE 'wait/synch/mutex/%';</code></strong>

mysql&gt; <strong class="userinput"><code>UPDATE setup_consumers</code></strong>
       <strong class="userinput"><code>SET ENABLED = 'NO' WHERE NAME LIKE '%history%';</code></strong>
</pre><p>
        If you use a pattern, it should be chosen so that it matches all
        the items of interest and no others. For example, to select all
        file I/O instruments, it is better to use a pattern that
        includes the entire instrument name prefix:
      </p><pre data-lang="sql" class="programlisting">
... WHERE NAME LIKE 'wait/io/file/%';
</pre><p>
        A pattern of <code class="literal">'%/file/%'</code> will match other
        instruments that have a component of <code class="literal">'/file/'</code>
        anywhere in the name. Even less suitable is the pattern
        <code class="literal">'%file%'</code> because it will match instruments
        with <code class="literal">'file'</code> anywhere in the name, such as
        <code class="literal">wait/synch/mutex/innodb/file_open_mutex</code>.
      </p><p>
        To check which instrument or consumer names a pattern matches,
        perform a simple test:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT NAME FROM setup_instruments WHERE NAME LIKE '<em class="replaceable"><code>pattern</code></em>';</code></strong>

mysql&gt; <strong class="userinput"><code>SELECT NAME FROM setup_consumers WHERE NAME LIKE '<em class="replaceable"><code>pattern</code></em>';</code></strong>
</pre><p>
        For information about the types of names that are supported, see
        <a class="xref" href="performance-schema.html#performance-schema-instrument-naming" title="25.6 Performance Schema Instrument Naming Conventions">Section 25.6, “Performance Schema Instrument Naming Conventions”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-instrumentation-checking"></a>25.4.10 Determining What Is Instrumented</h3>

</div>

</div>

</div>
<p>
        It is always possible to determine what instruments the
        Performance Schema includes by checking the
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table. For
        example, to see what file-related events are instrumented for
        the <code class="literal">InnoDB</code> storage engine, use this query:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments WHERE NAME LIKE 'wait/io/file/innodb/%';</code></strong>
+--------------------------------------+---------+-------+
| NAME                                 | ENABLED | TIMED |
+--------------------------------------+---------+-------+
| wait/io/file/innodb/innodb_data_file | YES     | YES   |
| wait/io/file/innodb/innodb_log_file  | YES     | YES   |
| wait/io/file/innodb/innodb_temp_file | YES     | YES   |
+--------------------------------------+---------+-------+
</pre><p>
        An exhaustive description of precisely what is instrumented is
        not given in this documentation, for several reasons:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            What is instrumented is the server code. Changes to this
            code occur often, which also affects the set of instruments.
          </p></li><li class="listitem"><p>
            It is not practical to list all the instruments because
            there are hundreds of them.
          </p></li><li class="listitem"><p>
            As described earlier, it is possible to find out by querying
            the <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
            This information is always up to date for your version of
            MySQL, also includes instrumentation for instrumented
            plugins you might have installed that are not part of the
            core server, and can be used by automated tools.
</p></li></ul>
</div>

</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-queries"></a>25.5 Performance Schema Queries</h2>

</div>

</div>

</div>
<p>
      Pre-filtering limits which event information is collected and is
      independent of any particular user. By contrast, post-filtering is
      performed by individual users through the use of queries with
      appropriate <code class="literal">WHERE</code> clauses that restrict what
      event information to select from the events available after
      pre-filtering has been applied.
    </p><p>
      In <a class="xref" href="performance-schema.html#performance-schema-pre-filtering" title="25.4.3 Event Pre-Filtering">Section 25.4.3, “Event Pre-Filtering”</a>, an example
      showed how to pre-filter for file instruments. If the event tables
      contain both file and nonfile information, post-filtering is
      another way to see information only for file events. Add a
      <code class="literal">WHERE</code> clause to queries to restrict event
      selection appropriately:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT THREAD_ID, NUMBER_OF_BYTES</code></strong>
       <strong class="userinput"><code>FROM events_waits_history</code></strong>
       <strong class="userinput"><code>WHERE EVENT_NAME LIKE 'wait/io/file/%'</code></strong>
       <strong class="userinput"><code>AND NUMBER_OF_BYTES IS NOT NULL;</code></strong>
+-----------+-----------------+
| THREAD_ID | NUMBER_OF_BYTES |
+-----------+-----------------+
|        11 |              66 |
|        11 |              47 |
|        11 |             139 |
|         5 |              24 |
|         5 |             834 |
+-----------+-----------------+
</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-instrument-naming"></a>25.6 Performance Schema Instrument Naming Conventions</h2>

</div>

</div>

</div>
<p>
      An instrument name consists of a sequence of components separated
      by <code class="literal">'/'</code> characters. Example names:
    </p><pre data-lang="none" class="programlisting">
wait/io/file/myisam/log
wait/io/file/mysys/charset
wait/lock/table/sql/handler
wait/synch/cond/mysys/COND_alarm
wait/synch/cond/sql/BINLOG::update_cond
wait/synch/mutex/mysys/BITMAP_mutex
wait/synch/mutex/sql/LOCK_delete
wait/synch/rwlock/sql/Query_cache_query::lock
stage/sql/closing tables
stage/sql/Sorting result
statement/com/Execute
statement/com/Query
statement/sql/create_table
statement/sql/lock_tables
</pre><p>
      The instrument name space has a tree-like structure. The
      components of an instrument name from left to right provide a
      progression from more general to more specific. The number of
      components a name has depends on the type of instrument.
    </p><p>
      The interpretation of a given component in a name depends on the
      components to the left of it. For example,
      <code class="literal">myisam</code> appears in both of the following names,
      but <code class="literal">myisam</code> in the first name is related to file
      I/O, whereas in the second it is related to a synchronization
      instrument:
    </p><pre data-lang="none" class="programlisting">
wait/io/file/myisam/log
wait/synch/cond/myisam/MI_SORT_INFO::cond
</pre><p>
      Instrument names consist of a prefix with a structure defined by
      the Performance Schema implementation and a suffix defined by the
      developer implementing the instrument code. The top-level
      component of an instrument prefix indicates the type of
      instrument. This component also determines which event timer in
      the <code class="literal">setup_timers</code> table applies to the
      instrument. For the prefix part of instrument names, the top level
      indicates the type of instrument.
    </p><p>
      The suffix part of instrument names comes from the code for the
      instruments themselves. Suffixes may include levels such as these:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          A name for the major component (a server module such as
          <code class="literal">myisam</code>, <code class="literal">innodb</code>,
          <code class="literal">mysys</code>, or <code class="literal">sql</code>) or a
          plugin name.
        </p></li><li class="listitem"><p>
          The name of a variable in the code, in the form
          <em class="replaceable"><code>XXX</code></em> (a global variable) or
          <code class="literal"><em class="replaceable"><code>CCC</code></em>::<em class="replaceable"><code>MMM</code></em></code>
          (a member <em class="replaceable"><code>MMM</code></em> in class
          <em class="replaceable"><code>CCC</code></em>). Examples:
          <code class="literal">COND_thread_cache</code>,
          <code class="literal">THR_LOCK_myisam</code>,
          <code class="literal">BINLOG::LOCK_index</code>.
</p></li></ul>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-top-level-instrument-components" title="Top-Level Instrument Components">Top-Level Instrument Components</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-idle-instrument-components" title="Idle Instrument Components">Idle Instrument Components</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-memory-instrument-components" title="Memory Instrument Components">Memory Instrument Components</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-stage-instrument-components" title="Stage Instrument Components">Stage Instrument Components</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-statement-instrument-components" title="Statement Instrument Components">Statement Instrument Components</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#performance-schema-wait-instrument-components" title="Wait Instrument Components">Wait Instrument Components</a></p></li></ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title"><a name="performance-schema-top-level-instrument-components"></a>Top-Level Instrument Components</h3>

</div>

</div>

</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">idle</code>: An instrumented idle event. This
            instrument has no further components.
          </p></li><li class="listitem"><p>
            <code class="literal">memory</code>: An instrumented memory event.
          </p></li><li class="listitem"><p>
            <code class="literal">stage</code>: An instrumented stage event.
          </p></li><li class="listitem"><p>
            <code class="literal">statement</code>: An instrumented statement
            event.
          </p></li><li class="listitem"><p>
            <code class="literal">transaction</code>: An instrumented transaction
            event. This instrument has no further components.
          </p></li><li class="listitem"><p>
            <code class="literal">wait</code>: An instrumented wait event.
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title"><a name="performance-schema-idle-instrument-components"></a>Idle Instrument Components</h3>

</div>

</div>

</div>
<p>
        The <code class="literal">idle</code> instrument is used for idle events,
        which The Performance Schema generates as discussed in the
        description of the <code class="literal">socket_instances.STATE</code>
        column in <a class="xref" href="performance-schema.html#socket-instances-table" title="25.11.3.5 The socket_instances Table">Section 25.11.3.5, “The socket_instances Table”</a>.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title"><a name="performance-schema-memory-instrument-components"></a>Memory Instrument Components</h3>

</div>

</div>

</div>
<p>
        Most memory instrumentation is disabled by default, and can be
        enabled or disabled at startup, or dynamically at runtime by
        updating the <code class="literal">ENABLED</code> column of the relevant
        instruments in the
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table. Memory
        instruments have names of the form
        <code class="literal">memory/<em class="replaceable"><code>code_area</code></em>/<em class="replaceable"><code>instrument_name</code></em></code>
        where <em class="replaceable"><code>code_area</code></em> is a value such as
        <code class="literal">sql</code> or <code class="literal">myisam</code>, and
        <em class="replaceable"><code>instrument_name</code></em> is the instrument
        detail.
      </p><p>
        Instruments named with the prefix
        <code class="literal">memory/performance_schema/</code> expose how much
        memory is allocated for internal buffers in the Performance
        Schema. The <code class="literal">memory/performance_schema/</code>
        instruments are built in, always enabled, and cannot be disabled
        at startup or runtime. Built-in memory instruments are displayed
        only in the
        <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_global_by_event_name</code></a>
        table. For more information, see
        <a class="xref" href="performance-schema.html#performance-schema-memory-model" title="25.16 The Performance Schema Memory-Allocation Model">Section 25.16, “The Performance Schema Memory-Allocation Model”</a>.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title"><a name="performance-schema-stage-instrument-components"></a>Stage Instrument Components</h3>

</div>

</div>

</div>
<p>
        Stage instruments have names of the form
        <code class="literal">stage/<em class="replaceable"><code>code_area</code></em>/<em class="replaceable"><code>stage_name</code></em></code>,
        where <em class="replaceable"><code>code_area</code></em> is a value such as
        <code class="literal">sql</code> or <code class="literal">myisam</code>, and
        <em class="replaceable"><code>stage_name</code></em> indicates the stage of
        statement processing, such as <code class="literal">Sorting result</code>
        or <code class="literal">Sending data</code>. Stages correspond to the
        thread states displayed by <a class="link" href="sql-syntax.html#show-processlist" title="13.7.5.29 SHOW PROCESSLIST Syntax"><code class="literal">SHOW
        PROCESSLIST</code></a> or that are visible in the
        <a class="link" href="information-schema.html#processlist-table" title="24.18 The INFORMATION_SCHEMA PROCESSLIST Table"><code class="literal">INFORMATION_SCHEMA.PROCESSLIST</code></a>
        table.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title"><a name="performance-schema-statement-instrument-components"></a>Statement Instrument Components</h3>

</div>

</div>

</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">statement/abstract/*</code>: An abstract
            instrument for statement operations. Abstract instruments
            are used during the early stages of statement classification
            before the exact statement type is known, then changed to a
            more specific statement instrument when the type is known.
            For a description of this process, see
            <a class="xref" href="performance-schema.html#performance-schema-statement-tables" title="25.11.6 Performance Schema Statement Event Tables">Section 25.11.6, “Performance Schema Statement Event Tables”</a>.
          </p></li><li class="listitem"><p>
            <code class="literal">statement/com</code>: An instrumented command
            operation. These have names corresponding to
            <code class="literal">COM_<em class="replaceable"><code>xxx</code></em></code>
            operations (see the <code class="filename">mysql_com.h</code> header
            file and <code class="filename">sql/sql_parse.cc</code>. For example,
            the <code class="literal">statement/com/Connect</code> and
            <code class="literal">statement/com/Init DB</code> instruments
            correspond to the <code class="literal">COM_CONNECT</code> and
            <code class="literal">COM_INIT_DB</code> commands.
          </p></li><li class="listitem"><p>
            <code class="literal">statement/scheduler/event</code>: A single
            instrument to track all events executed by the Event
            Scheduler. This instrument comes into play when a scheduled
            event begins executing.
          </p></li><li class="listitem"><p>
            <code class="literal">statement/sp</code>: An instrumented internal
            instruction executed by a stored program. For example, the
            <code class="literal">statement/sp/cfetch</code> and
            <code class="literal">statement/sp/freturn</code> instruments are used
            cursor fetch and function return instructions.
          </p></li><li class="listitem"><p>
            <code class="literal">statement/sql</code>: An instrumented SQL
            statement operation. For example, the
            <code class="literal">statement/sql/create_db</code> and
            <code class="literal">statement/sql/select</code> instruments are used
            for <a class="link" href="sql-syntax.html#create-database" title="13.1.11 CREATE DATABASE Syntax"><code class="literal">CREATE DATABASE</code></a> and
            <a class="link" href="sql-syntax.html#select" title="13.2.9 SELECT Syntax"><code class="literal">SELECT</code></a> statements.
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title"><a name="performance-schema-wait-instrument-components"></a>Wait Instrument Components</h3>

</div>

</div>

</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">wait/io</code>
          </p><p>
            An instrumented I/O operation.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                <code class="literal">wait/io/file</code>
              </p><p>
                An instrumented file I/O operation. For files, the wait
                is the time waiting for the file operation to complete
                (for example, a call to <code class="literal">fwrite()</code>).
                Due to caching, the physical file I/O on the disk might
                not happen within this call.
              </p></li><li class="listitem"><p>
                <code class="literal">wait/io/socket</code>
              </p><p>
                An instrumented socket operation. Socket instruments
                have names of the form
                <code class="literal">wait/io/socket/sql/<em class="replaceable"><code>socket_type</code></em></code>.
                The server has a listening socket for each network
                protocol that it supports. The instruments associated
                with listening sockets for TCP/IP or Unix socket file
                connections have a
                <em class="replaceable"><code>socket_type</code></em> value of
                <code class="literal">server_tcpip_socket</code> or
                <code class="literal">server_unix_socket</code>, respectively.
                When a listening socket detects a connection, the server
                transfers the connection to a new socket managed by a
                separate thread. The instrument for the new connection
                thread has a <em class="replaceable"><code>socket_type</code></em>
                value of <code class="literal">client_connection</code>.
              </p></li><li class="listitem"><p>
                <code class="literal">wait/io/table</code>
              </p><p>
                An instrumented table I/O operation. These include
                row-level accesses to persistent base tables or
                temporary tables. Operations that affect rows are fetch,
                insert, update, and delete. For a view, waits are
                associated with base tables referenced by the view.
              </p><p>
                Unlike most waits, a table I/O wait can include other
                waits. For example, table I/O might include file I/O or
                memory operations. Thus,
                <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> for a
                table I/O wait usually has two rows. For more
                information, see
                <a class="xref" href="performance-schema.html#performance-schema-atom-molecule-events" title="25.8 Performance Schema Atom and Molecule Events">Section 25.8, “Performance Schema Atom and Molecule Events”</a>.
              </p><p>
                Some row operations might cause multiple table I/O
                waits. For example, an insert might activate a trigger
                that causes an update.
</p></li></ul>
</div>
</li><li class="listitem"><p>
            <code class="literal">wait/lock</code>
          </p><p>
            An instrumented lock operation.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                <code class="literal">wait/lock/table</code>
              </p><p>
                An instrumented table lock operation.
              </p></li><li class="listitem"><p>
                <code class="literal">wait/lock/metadata/sql/mdl</code>
              </p><p>
                An instrumented metadata lock operation.
</p></li></ul>
</div>
</li><li class="listitem"><p>
            <code class="literal">wait/synch</code>
          </p><p>
            An instrumented synchronization object. For synchronization
            objects, the <code class="literal">TIMER_WAIT</code> time includes the
            amount of time blocked while attempting to acquire a lock on
            the object, if any.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                <code class="literal">wait/synch/cond</code>
              </p><p>
                A condition is used by one thread to signal to other
                threads that something they were waiting for has
                happened. If a single thread was waiting for a
                condition, it can wake up and proceed with its
                execution. If several threads were waiting, they can all
                wake up and compete for the resource for which they were
                waiting.
              </p></li><li class="listitem"><p>
                <code class="literal">wait/synch/mutex</code>
              </p><p>
                A mutual exclusion object used to permit access to a
                resource (such as a section of executable code) while
                preventing other threads from accessing the resource.
              </p></li><li class="listitem"><p>
                <code class="literal">wait/synch/rwlock</code>
              </p><p>
                A <a class="link" href="glossary.html#glos_rw_lock" title="rw-lock">read/write lock</a>
                object used to lock a specific variable for access while
                preventing its use by other threads. A shared read lock
                can be acquired simultaneously by multiple threads. An
                exclusive write lock can be acquired by only one thread
                at a time.
              </p></li><li class="listitem"><p>
                <code class="literal">wait/synch/sxlock</code>
              </p><p>
                A shared-exclusive (SX) lock is a type of
                <a class="link" href="glossary.html#glos_rw_lock" title="rw-lock">rwlock</a> lock object
                that provides write access to a common resource while
                permitting inconsistent reads by other threads.
                <code class="literal">sxlocks</code> optimize concurrency and
                improve scalability for read-write workloads.
</p></li></ul>
</div>
</li></ul>
</div>

</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-status-monitoring"></a>25.7 Performance Schema Status Monitoring</h2>

</div>

</div>

</div>
<p>
      There are several status variables associated with the Performance
      Schema:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SHOW STATUS LIKE 'perf%';</code></strong>
+-----------------------------------------------+-------+
| Variable_name                                 | Value |
+-----------------------------------------------+-------+
| Performance_schema_accounts_lost              | 0     |
| Performance_schema_cond_classes_lost          | 0     |
| Performance_schema_cond_instances_lost        | 0     |
| Performance_schema_digest_lost                | 0     |
| Performance_schema_file_classes_lost          | 0     |
| Performance_schema_file_handles_lost          | 0     |
| Performance_schema_file_instances_lost        | 0     |
| Performance_schema_hosts_lost                 | 0     |
| Performance_schema_locker_lost                | 0     |
| Performance_schema_memory_classes_lost        | 0     |
| Performance_schema_metadata_lock_lost         | 0     |
| Performance_schema_mutex_classes_lost         | 0     |
| Performance_schema_mutex_instances_lost       | 0     |
| Performance_schema_nested_statement_lost      | 0     |
| Performance_schema_program_lost               | 0     |
| Performance_schema_rwlock_classes_lost        | 0     |
| Performance_schema_rwlock_instances_lost      | 0     |
| Performance_schema_session_connect_attrs_lost | 0     |
| Performance_schema_socket_classes_lost        | 0     |
| Performance_schema_socket_instances_lost      | 0     |
| Performance_schema_stage_classes_lost         | 0     |
| Performance_schema_statement_classes_lost     | 0     |
| Performance_schema_table_handles_lost         | 0     |
| Performance_schema_table_instances_lost       | 0     |
| Performance_schema_thread_classes_lost        | 0     |
| Performance_schema_thread_instances_lost      | 0     |
| Performance_schema_users_lost                 | 0     |
+-----------------------------------------------+-------+
</pre><p>
      The Performance Schema status variables provide information about
      instrumentation that could not be loaded or created due to memory
      constraints. Names for these variables have several forms:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          <code class="literal">Performance_schema_<em class="replaceable"><code>xxx</code></em>_classes_lost</code>
          indicates how many instruments of type
          <em class="replaceable"><code>xxx</code></em> could not be loaded.
        </p></li><li class="listitem"><p>
          <code class="literal">Performance_schema_<em class="replaceable"><code>xxx</code></em>_instances_lost</code>
          indicates how many instances of object type
          <em class="replaceable"><code>xxx</code></em> could not be created.
        </p></li><li class="listitem"><p>
          <code class="literal">Performance_schema_<em class="replaceable"><code>xxx</code></em>_handles_lost</code>
          indicates how many instances of object type
          <em class="replaceable"><code>xxx</code></em> could not be opened.
        </p></li><li class="listitem"><p>
          <code class="literal">Performance_schema_locker_lost</code> indicates
          how many events are <span class="quote">“<span class="quote">lost</span>”</span> or not recorded.
</p></li></ul>
</div>
<p>
      For example, if a mutex is instrumented in the server source but
      the server cannot allocate memory for the instrumentation at
      runtime, it increments
      <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_classes_lost"><code class="literal">Performance_schema_mutex_classes_lost</code></a>.
      The mutex still functions as a synchronization object (that is,
      the server continues to function normally), but performance data
      for it will not be collected. If the instrument can be allocated,
      it can be used for initializing instrumented mutex instances. For
      a singleton mutex such as a global mutex, there will be only one
      instance. Other mutexes have an instance per connection, or per
      page in various caches and data buffers, so the number of
      instances varies over time. Increasing the maximum number of
      connections or the maximum size of some buffers will increase the
      maximum number of instances that might be allocated at once. If
      the server cannot create a given instrumented mutex instance, it
      increments
      <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_instances_lost"><code class="literal">Performance_schema_mutex_instances_lost</code></a>.
    </p><p>
      Suppose that the following conditions hold:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          The server was started with the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_classes"><code class="option">--performance_schema_max_mutex_classes=200</code></a>
          option and thus has room for 200 mutex instruments.
        </p></li><li class="listitem"><p>
          150 mutex instruments have been loaded already.
        </p></li><li class="listitem"><p>
          The plugin named <code class="literal">plugin_a</code> contains 40 mutex
          instruments.
        </p></li><li class="listitem"><p>
          The plugin named <code class="literal">plugin_b</code> contains 20 mutex
          instruments.
</p></li></ul>
</div>
<p>
      The server allocates mutex instruments for the plugins depending
      on how many they need and how many are available, as illustrated
      by the following sequence of statements:
    </p><pre data-lang="sql" class="programlisting">
INSTALL PLUGIN plugin_a
</pre><p>
      The server now has 150+40 = 190 mutex instruments.
    </p><pre data-lang="sql" class="programlisting">
UNINSTALL PLUGIN plugin_a;
</pre><p>
      The server still has 190 instruments. All the historical data
      generated by the plugin code is still available, but new events
      for the instruments are not collected.
    </p><pre data-lang="sql" class="programlisting">
INSTALL PLUGIN plugin_a;
</pre><p>
      The server detects that the 40 instruments are already defined, so
      no new instruments are created, and previously assigned internal
      memory buffers are reused. The server still has 190 instruments.
    </p><pre data-lang="sql" class="programlisting">
INSTALL PLUGIN plugin_b;
</pre><p>
      The server has room for 200-190 = 10 instruments (in this case,
      mutex classes), and sees that the plugin contains 20 new
      instruments. 10 instruments are loaded, and 10 are discarded or
      <span class="quote">“<span class="quote">lost.</span>”</span> The
      <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_classes_lost"><code class="literal">Performance_schema_mutex_classes_lost</code></a>
      indicates the number of instruments (mutex classes) lost:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SHOW STATUS LIKE "perf%mutex_classes_lost";</code></strong>
+---------------------------------------+-------+
| Variable_name                         | Value |
+---------------------------------------+-------+
| Performance_schema_mutex_classes_lost | 10    |
+---------------------------------------+-------+
1 row in set (0.10 sec)
</pre><p>
      The instrumentation still works and collects (partial) data for
      <code class="literal">plugin_b</code>.
    </p><p>
      When the server cannot create a mutex instrument, these results
      occur:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          No row for the instrument is inserted into the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
        </p></li><li class="listitem"><p>
          <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_classes_lost"><code class="literal">Performance_schema_mutex_classes_lost</code></a>
          increases by 1.
        </p></li><li class="listitem"><p>
          <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_instances_lost"><code class="literal">Performance_schema_mutex_instances_lost</code></a>
          does not change. (When the mutex instrument is not created, it
          cannot be used to create instrumented mutex instances later.)
</p></li></ul>
</div>
<p>
      The pattern just described applies to all types of instruments,
      not just mutexes.
    </p><p>
      A value of
      <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_classes_lost"><code class="literal">Performance_schema_mutex_classes_lost</code></a>
      greater than 0 can happen in two cases:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          To save a few bytes of memory, you start the server with
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_classes"><code class="option">--performance_schema_max_mutex_classes=<em class="replaceable"><code>N</code></em></code></a>,
          where <em class="replaceable"><code>N</code></em> is less than the default
          value. The default value is chosen to be sufficient to load
          all the plugins provided in the MySQL distribution, but this
          can be reduced if some plugins are never loaded. For example,
          you might choose not to load some of the storage engines in
          the distribution.
        </p></li><li class="listitem"><p>
          You load a third-party plugin that is instrumented for the
          Performance Schema but do not allow for the plugin's
          instrumentation memory requirements when you start the server.
          Because it comes from a third party, the instrument memory
          consumption of this engine is not accounted for in the default
          value chosen for
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_classes"><code class="literal">performance_schema_max_mutex_classes</code></a>.
        </p><p>
          If the server has insufficient resources for the plugin's
          instruments and you do not explicitly allocate more using
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_classes"><code class="option">--performance_schema_max_mutex_classes=<em class="replaceable"><code>N</code></em></code></a>,
          loading the plugin leads to starvation of instruments.
</p></li></ul>
</div>
<p>
      If the value chosen for
      <a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_classes"><code class="literal">performance_schema_max_mutex_classes</code></a>
      is too small, no error is reported in the error log and there is
      no failure at runtime. However, the content of the tables in the
      <code class="literal">performance_schema</code> database will miss events.
      The
      <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_classes_lost"><code class="literal">Performance_schema_mutex_classes_lost</code></a>
      status variable is the only visible sign to indicate that some
      events were dropped internally due to failure to create
      instruments.
    </p><p>
      If an instrument is not lost, it is known to the Performance
      Schema, and is used when instrumenting instances. For example,
      <code class="literal">wait/synch/mutex/sql/LOCK_delete</code> is the name of
      a mutex instrument in the
      <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table. This single
      instrument is used when creating a mutex in the code (in
      <code class="literal">THD::LOCK_delete</code>) however many instances of the
      mutex are needed as the server runs. In this case,
      <code class="literal">LOCK_delete</code> is a mutex that is per connection
      (<code class="literal">THD</code>), so if a server has 1000 connections,
      there are 1000 threads, and 1000 instrumented
      <code class="literal">LOCK_delete</code> mutex instances
      (<code class="literal">THD::LOCK_delete</code>).
    </p><p>
      If the server does not have room for all these 1000 instrumented
      mutexes (instances), some mutexes are created with
      instrumentation, and some are created without instrumentation. If
      the server can create only 800 instances, 200 instances are lost.
      The server continues to run, but increments
      <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_instances_lost"><code class="literal">Performance_schema_mutex_instances_lost</code></a>
      by 200 to indicate that instances could not be created.
    </p><p>
      A value of
      <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_instances_lost"><code class="literal">Performance_schema_mutex_instances_lost</code></a>
      greater than 0 can happen when the code initializes more mutexes
      at runtime than were allocated for
      <a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_instances"><code class="option">--performance_schema_max_mutex_instances=<em class="replaceable"><code>N</code></em></code></a>.
    </p><p>
      The bottom line is that if
      <a class="link" href="sql-syntax.html#show-status" title="13.7.5.35 SHOW STATUS Syntax"><code class="literal">SHOW STATUS LIKE
      'perf%'</code></a> says that nothing was lost (all values are
      zero), the Performance Schema data is accurate and can be relied
      upon. If something was lost, the data is incomplete, and the
      Performance Schema could not record everything given the
      insufficient amount of memory it was given to use. In this case,
      the specific
      <code class="literal">Performance_schema_<em class="replaceable"><code>xxx</code></em>_lost</code>
      variable indicates the problem area.
    </p><p>
      It might be appropriate in some cases to cause deliberate
      instrument starvation. For example, if you do not care about
      performance data for file I/O, you can start the server with all
      Performance Schema parameters related to file I/O set to 0. No
      memory will be allocated for file-related classes, instances, or
      handles, and all file events will be lost.
    </p><p>
      Use <a class="link" href="sql-syntax.html#show-engine" title="13.7.5.15 SHOW ENGINE Syntax"><code class="literal">SHOW ENGINE
      PERFORMANCE_SCHEMA STATUS</code></a> to inspect the internal
      operation of the Performance Schema code:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SHOW ENGINE PERFORMANCE_SCHEMA STATUS\G</code></strong>
...
*************************** 3. row ***************************
  Type: performance_schema
  Name: events_waits_history.size
Status: 76
*************************** 4. row ***************************
  Type: performance_schema
  Name: events_waits_history.count
Status: 10000
*************************** 5. row ***************************
  Type: performance_schema
  Name: events_waits_history.memory
Status: 760000
...
*************************** 57. row ***************************
  Type: performance_schema
  Name: performance_schema.memory
Status: 26459600
...
</pre><p>
      This statement is intended to help the DBA understand the effects
      that different Performance Schema options have on memory
      requirements. For a description of the field meanings, see
      <a class="xref" href="sql-syntax.html#show-engine" title="13.7.5.15 SHOW ENGINE Syntax">Section 13.7.5.15, “SHOW ENGINE Syntax”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-atom-molecule-events"></a>25.8 Performance Schema Atom and Molecule Events</h2>

</div>

</div>

</div>
<p>
      For a table I/O event, there are usually two rows in
      <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>, not one. For
      example, a row fetch might result in rows like this:
    </p><pre data-lang="none" class="programlisting">
Row# EVENT_NAME                 TIMER_START TIMER_END
---- ----------                 ----------- ---------
   1 wait/io/file/myisam/dfile        10001 10002
   2 wait/io/table/sql/handler        10000 NULL
</pre><p>
      The row fetch causes a file read. In the example, the table I/O
      fetch event started before the file I/O event but has not finished
      (its <code class="literal">TIMER_END</code> value is
      <code class="literal">NULL</code>). The file I/O event is
      <span class="quote">“<span class="quote">nested</span>”</span> within the table I/O event.
    </p><p>
      This occurs because, unlike other <span class="quote">“<span class="quote">atomic</span>”</span> wait
      events such as for mutexes or file I/O, table I/O events are
      <span class="quote">“<span class="quote">molecular</span>”</span> and include (overlap with) other events.
      In <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>, the table
      I/O event usually has two rows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          One row for the most recent table I/O wait event
        </p></li><li class="listitem"><p>
          One row for the most recent wait event of any kind
</p></li></ul>
</div>
<p>
      Usually, but not always, the <span class="quote">“<span class="quote">of any kind</span>”</span> wait event
      differs from the table I/O event. As each subsidiary event
      completes, it disappears from
      <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>. At this point,
      and until the next subsidiary event begins, the table I/O wait is
      also the most recent wait of any kind.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-statement-digests"></a>25.9 Performance Schema Statement Digests</h2>

</div>

</div>

</div>
<p>
      The MySQL server is capable of maintaining statement digest
      information. The digesting process converts each SQL statement to
      normalized form (the statement digest) and computes an MD5 hash
      value (the digest hash value) from the normalized result.
      Normalization permits statements that are similar to be grouped
      and summarized to expose information about the types of statements
      the server is executing and how often they occur. This section
      describes how statement digesting occurs and how it can be useful.
    </p><p>
      Digesting occurs in the parser regardless of whether the
      Performance Schema is available, so that other server components
      such as MySQL Enterprise Firewall and query rewrite plugins have access to statement
      digests.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="xref" href="performance-schema.html#statement-digests-general" title="Statement Digest General Concepts">Statement Digest General Concepts</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#statement-digests-performance-schema" title="Statement Digests in the Performance Schema">Statement Digests in the Performance Schema</a></p></li><li class="listitem"><p><a class="xref" href="performance-schema.html#statement-digests-memory-use" title="Statement Digest Memory Use">Statement Digest Memory Use</a></p></li></ul>
</div>

<div class="simplesect">

<div class="titlepage">
<div>

<div class="simple">
<h3 class="title"><a name="statement-digests-general"></a>Statement Digest General Concepts</h3>

</div>

</div>

</div>
<p>
        When the parser receives an SQL statement, it computes a
        statement digest if that digest is needed, which is true if any
        of the following conditions are true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Performance Schema digest instrumentation is enabled
          </p></li><li class="listitem"><p>
            MySQL Enterprise Firewall is enabled
          </p></li><li class="listitem"><p>
            A Query Rewrite Plugin is enabled
</p></li></ul>
</div>
<p>
        The <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> system
        variable value determines the maximum number of bytes available
        for computing normalized statement digests. Once that amount of
        space is used during digest computation, truncation occurs: no
        further tokens from a parsed statement are collected or figure
        into its digest value. Statements that differ only after that
        many bytes of parsed tokens produce the same normalized
        statement digest and are considered identical if compared or if
        aggregated for digest statistics.
      </p><p>
        After the normalized statement has been computed, an MD5 hash
        value is computed from it. In addition:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            If MySQL Enterprise Firewall is enabled, it is called and the digest as
            computed is available to it.
          </p></li><li class="listitem"><p>
            If any Query Rewrite Plugin is enabled, it is called and the
            statement digest and digest value are available to it.
          </p></li><li class="listitem"><p>
            If the Performance Schema has digest instrumentation
            enabled, it makes a copy of the normalized statement digest,
            allocating a maximum of
            <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
            bytes for it. Consequently, if
            <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
            is less than
            <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a>, the copy
            is truncated relative to the original. The copy of the
            normalized statement digest is stored in the appropriate
            Performance Schema tables, along with the MD5 hash value
            computed from the original normalized statement. (If the
            Performance Schema truncates its copy of the normalized
            statement digest relative to the original, it does not
            recompute the MD5 hash value.)
</p></li></ul>
</div>
<p>
        Statement normalization transforms the statement text to a more
        standardized digest string representation that preserves the
        general statement structure while removing information not
        essential to the structure:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Object identifiers such as database and table names are
            preserved.
          </p></li><li class="listitem"><p>
            Literal values are converted to parameter markers. A
            normalized statement does not retain information such as
            names, passwords, dates, and so forth.
          </p></li><li class="listitem"><p>
            Comments are removed and whitespace is adjusted.
</p></li></ul>
</div>
<p>
        Consider these statements:
      </p><pre data-lang="sql" class="programlisting">
SELECT * FROM orders WHERE customer_id=10 AND quantity&gt;20
SELECT * FROM orders WHERE customer_id = 20 AND quantity &gt; 100
</pre><p>
        To normalize these statements, the parser replaces data values
        by <code class="literal">?</code> and adjusts whitespace. Both statements
        yield the same normalized form and thus are considered
        <span class="quote">“<span class="quote">the same</span>”</span>:
      </p><pre data-lang="sql" class="programlisting">
SELECT * FROM orders WHERE customer_id = ? AND quantity &gt; ?
</pre><p>
        The normalized statement contains less information but is still
        representative of the original statement. Other similar
        statements that have different data values have the same
        normalized form.
      </p><p>
        Now consider these statements:
      </p><pre data-lang="sql" class="programlisting">
SELECT * FROM customers WHERE customer_id = 1000
SELECT * FROM orders WHERE customer_id = 1000
</pre><p>
        In this case, the normalized statements differ because the
        object identifiers differ:
      </p><pre data-lang="sql" class="programlisting">
SELECT * FROM customers WHERE customer_id = ?
SELECT * FROM orders WHERE customer_id = ?
</pre><p>
        If normalization produces a statement that exceeds the space
        available in the digest buffer (as determined by
        <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a>), truncation
        occurs and the text ends with <span class="quote">“<span class="quote">...</span>”</span>. Long
        normalized statements that differ only in the part that occurs
        following the <span class="quote">“<span class="quote">...</span>”</span> are considered the same.
        Consider these statements:
      </p><pre data-lang="sql" class="programlisting">
SELECT * FROM mytable WHERE cola = 10 AND colb = 20
SELECT * FROM mytable WHERE cola = 10 AND colc = 20
</pre><p>
        If the cutoff happens to be right after the
        <code class="literal">AND</code>, both statements have this normalized
        form:
      </p><pre data-lang="sql" class="programlisting">
SELECT * FROM mytable WHERE cola = ? AND ...
</pre><p>
        In this case, the difference in the second column name is lost
        and both statements are considered the same.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title"><a name="statement-digests-performance-schema"></a>Statement Digests in the Performance Schema</h3>

</div>

</div>

</div>
<p>
        In the Performance Schema, statement digesting involves these
        components:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            A <code class="literal">statements_digest</code> consumer in the
            <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table controls
            whether the Performance Schema maintains digest information.
            See
            <a class="xref" href="performance-schema.html#performance-schema-consumer-filtering-statement-digest" title="Statement Digest Consumer">Statement Digest Consumer</a>.
          </p></li><li class="listitem"><p>
            The statement event tables
            (<a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>,
            <a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a>, and
            <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>)
            have columns for storing normalized statement digests and
            the corresponding digest MD5 hash values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                <code class="literal">DIGEST_TEXT</code> is the text of the
                normalized statement digest. This is a copy of the
                original normalized statement that was computed to a
                maximum of
                <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a>
                bytes, further truncated as necessary to
                <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
                bytes.
              </p></li><li class="listitem"><p>
                <code class="literal">DIGEST</code> is the digest MD5 hash value
                computed from the original normalized statement.
</p></li></ul>
</div>
<p>
            See <a class="xref" href="performance-schema.html#performance-schema-statement-tables" title="25.11.6 Performance Schema Statement Event Tables">Section 25.11.6, “Performance Schema Statement Event Tables”</a>.
          </p></li><li class="listitem"><p>
            The
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>
            summary table provides aggregated statement digest
            information. This table aggregates information for
            statements per <code class="literal">SCHEMA_NAME</code> and
            <code class="literal">DIGEST</code> combination. The Performance
            Schema uses MD5 hash values for aggregation because they are
            fast to compute and have a favorable statistical
            distribution that minimizes collisions. See
            <a class="xref" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables">Section 25.11.15.3, “Statement Summary Tables”</a>.
</p></li></ul>
</div>
<p>
        The statement event tables also have an
        <code class="literal">SQL_TEXT</code> column that contains the original
        SQL statement. The maximum space available for statement display
        is 1024 bytes by default. To change this value, set the
        <a class="link" href="performance-schema.html#sysvar_performance_schema_max_sql_text_length"><code class="literal">performance_schema_max_sql_text_length</code></a>
        system variable at server startup.
      </p><p>
        The
        <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
        system variable determines the maximum number of bytes available
        for digest value storage in the Performance Schema. However, the
        display length of statement digests may be longer than the
        available buffer size due to internal encoding of statement
        components such as keywords and literal values. Consequently,
        values selected from the <code class="literal">DIGEST_TEXT</code> column
        of statement event tables may appear to exceed the
        <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
        value.
      </p><p>
        The
        <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>
        summary table provides a profile of the statements executed by
        the server. It shows what kinds of statements an application is
        executing and how often. An application developer can use this
        information together with other information in the table to
        assess the application's performance characteristics. For
        example, table columns that show wait times, lock times, or
        index use may highlight types of queries that are inefficient.
        This gives the developer insight into which parts of the
        application need attention.
      </p><p>
        The
        <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>
        summary table has a fixed size. By default the Performance
        Schema estimates the size to use at startup. To specify the
        table size explicitly, set the
        <a class="link" href="performance-schema.html#sysvar_performance_schema_digests_size"><code class="literal">performance_schema_digests_size</code></a>
        system variable at server startup. If the table becomes full,
        the Performance Schema groups statements that have
        <code class="literal">SCHEMA_NAME</code> and <code class="literal">DIGEST</code>
        values not matching existing values in the table in a special
        row with <code class="literal">SCHEMA_NAME</code> and
        <code class="literal">DIGEST</code> set to <code class="literal">NULL</code>. This
        permits all statements to be counted. However, if the special
        row accounts for a significant percentage of the statements
        executed, it might be desirable to increase the summary table
        size by increasing
        <a class="link" href="performance-schema.html#sysvar_performance_schema_digests_size"><code class="literal">performance_schema_digests_size</code></a>.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title"><a name="statement-digests-memory-use"></a>Statement Digest Memory Use</h3>

</div>

</div>

</div>
<p>
        For applications that generate very long statements that differ
        only at the end, increasing
        <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> enables
        computation of digests that distinguish statements that would
        otherwise aggregate to the same digest. Conversely, decreasing
        <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> causes the
        server to devote less memory to digest storage but increases the
        likelihood of longer statements aggregating to the same digest.
        Administrators should keep in mind that larger values result in
        correspondingly increased memory requirements, particularly for
        workloads that involve large numbers of simultaneous sessions
        (the server allocates
        <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> bytes per
        session).
      </p><p>
        As described previously, normalized statement digests as
        computed by the parser are constrained to a maximum of
        <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> bytes,
        whereas normalized statement digests stored in the Performance
        Schema use
        <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
        bytes. The following memory-use considerations apply regarding
        the relative values of
        <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> and
        <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            If <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> is
            less than
            <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                Server components other than the Performance Schema use
                normalized statement digests that take up to
                <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a>
                bytes.
              </p></li><li class="listitem"><p>
                The Performance Schema does not further truncate
                normalized statement digests that it stores, but
                allocates more memory than
                <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> bytes
                per digest, which is unnecessary.
</p></li></ul>
</div>
</li><li class="listitem"><p>
            If <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> equals
            <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                Server components other than the Performance Schema use
                normalized statement digests that take up to
                <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a>
                bytes.
              </p></li><li class="listitem"><p>
                The Performance Schema does not further truncate
                normalized statement digests that it stores, and
                allocates the same amount of memory as
                <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> bytes
                per digest.
</p></li></ul>
</div>
</li><li class="listitem"><p>
            If <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> is
            greater than
            <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                Server components other than the Performance Schema use
                normalized statement digests that take up to
                <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a>
                bytes.
              </p></li><li class="listitem"><p>
                The Performance Schema further truncates normalized
                statement digests that it stores, and allocates less
                memory than
                <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a> bytes
                per digest.
</p></li></ul>
</div>
</li></ul>
</div>
<p>
        Because the Performance Schema statement event tables might
        store many digests, setting
        <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
        smaller than <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a>
        enables administrators to balance these factors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The need to have long normalized statement digests available
            for server components outside the Performance Schema
          </p></li><li class="listitem"><p>
            Many concurrent sessions, each of which allocates
            digest-computation memory
          </p></li><li class="listitem"><p>
            The need to limit memory consumption by the Performance
            Schema statement event tables when storing many statement
            digests
</p></li></ul>
</div>
<p>
        To assess the amount of memory used for SQL statement storage
        and digest computation, use the
        <a class="link" href="sql-syntax.html#show-engine" title="13.7.5.15 SHOW ENGINE Syntax"><code class="literal">SHOW ENGINE
        PERFORMANCE_SCHEMA STATUS</code></a> statement, or monitor these
        instruments:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT NAME FROM setup_instruments</code></strong>
       <strong class="userinput"><code>WHERE NAME LIKE '%.sqltext';</code></strong>
+------------------------------------------------------------------+
| NAME                                                             |
+------------------------------------------------------------------+
| memory/performance_schema/events_statements_history.sqltext      |
| memory/performance_schema/events_statements_current.sqltext      |
| memory/performance_schema/events_statements_history_long.sqltext |
+------------------------------------------------------------------+

mysql&gt; <strong class="userinput"><code>SELECT NAME FROM setup_instruments</code></strong>
       <strong class="userinput"><code>WHERE NAME LIKE 'memory/performance_schema/%.tokens';</code></strong>
+----------------------------------------------------------------------+
| NAME                                                                 |
+----------------------------------------------------------------------+
| memory/performance_schema/events_statements_history.tokens           |
| memory/performance_schema/events_statements_current.tokens           |
| memory/performance_schema/events_statements_summary_by_digest.tokens |
| memory/performance_schema/events_statements_history_long.tokens      |
+----------------------------------------------------------------------+
</pre>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-table-characteristics"></a>25.10 Performance Schema General Table Characteristics</h2>

</div>

</div>

</div>
<p>
      The name of the <code class="literal">performance_schema</code> database is
      lowercase, as are the names of tables within it. Queries should
      specify the names in lowercase.
    </p><a class="indexterm" name="idm139684630539760"></a><a class="indexterm" name="idm139684630538256"></a><p>
      Many tables in the <code class="literal">performance_schema</code> database
      are read only and cannot be modified:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>TRUNCATE TABLE setup_instruments;</code></strong>
ERROR 1683 (HY000): Invalid performance_schema usage.
</pre><p>
      Some of the setup tables have columns that can be modified to
      affect Performance Schema operation; some also permit rows to be
      inserted or deleted. Truncation is permitted to clear collected
      events, so <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> can be
      used on tables containing those kinds of information, such as
      tables named with a prefix of <code class="literal">events_waits_</code>.
    </p><p>
      Summary tables can be truncated with <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE
      TABLE</code></a>. Generally, the effect is to reset the summary
      columns to 0 or <code class="literal">NULL</code>, not to remove rows. This
      enables you to clear collected values and restart aggregation.
      That might be useful, for example, after you have made a runtime
      configuration change. Exceptions to this truncation behavior are
      noted in individual summary table sections.
    </p><p>
      Privileges are as for other databases and tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          To retrieve from <code class="literal">performance_schema</code> tables,
          you must have the <a class="link" href="security.html#priv_select"><code class="literal">SELECT</code></a>
          privilege.
        </p></li><li class="listitem"><p>
          To change those columns that can be modified, you must have
          the <a class="link" href="security.html#priv_update"><code class="literal">UPDATE</code></a> privilege.
        </p></li><li class="listitem"><p>
          To truncate tables that can be truncated, you must have the
          <a class="link" href="security.html#priv_drop"><code class="literal">DROP</code></a> privilege.
</p></li></ul>
</div>
<p>
      Because only a limited set of privileges apply to Performance
      Schema tables, attempts to use <code class="literal">GRANT ALL</code> as
      shorthand for granting privileges at the database or table leval
      fail with an error:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>GRANT ALL ON performance_schema.*</code></strong>
       <strong class="userinput"><code>TO 'u1'@'localhost';</code></strong>
ERROR 1044 (42000): Access denied for user 'root'@'localhost'
to database 'performance_schema'
mysql&gt; <strong class="userinput"><code>GRANT ALL ON performance_schema.setup_instruments</code></strong>
       <strong class="userinput"><code>TO 'u2'@'localhost';</code></strong>
ERROR 1044 (42000): Access denied for user 'root'@'localhost'
to database 'performance_schema'
</pre><p>
      Instead, grant exactly the desired privileges:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>GRANT SELECT ON performance_schema.*</code></strong>
       <strong class="userinput"><code>TO 'u1'@'localhost';</code></strong>
Query OK, 0 rows affected (0.03 sec)

mysql&gt; <strong class="userinput"><code>GRANT SELECT, UPDATE ON performance_schema.setup_instruments</code></strong>
       <strong class="userinput"><code>TO 'u2'@'localhost';</code></strong>
Query OK, 0 rows affected (0.02 sec)
</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-table-descriptions"></a>25.11 Performance Schema Table Descriptions</h2>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#performance-schema-table-index">25.11.1 Performance Schema Table Index</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-setup-tables">25.11.2 Performance Schema Setup Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-instance-tables">25.11.3 Performance Schema Instance Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-wait-tables">25.11.4 Performance Schema Wait Event Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-stage-tables">25.11.5 Performance Schema Stage Event Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-statement-tables">25.11.6 Performance Schema Statement Event Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-transaction-tables">25.11.7 Performance Schema Transaction Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-connection-tables">25.11.8 Performance Schema Connection Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-connection-attribute-tables">25.11.9 Performance Schema Connection Attribute Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-user-variable-tables">25.11.10 Performance Schema User Variable Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-replication-tables">25.11.11 Performance Schema Replication Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-lock-tables">25.11.12 Performance Schema Lock Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-system-variable-tables">25.11.13 Performance Schema System Variable Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-status-variable-tables">25.11.14 Performance Schema Status Variable Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-summary-tables">25.11.15 Performance Schema Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-miscellaneous-tables">25.11.16 Performance Schema Miscellaneous Tables</a></span></dt></dl>
</div>
<p>
      Tables in the <code class="literal">performance_schema</code> database can
      be grouped as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          Setup tables. These tables are used to configure and display
          monitoring characteristics.
        </p></li><li class="listitem"><p>
          Current events tables. The
          <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> table
          contains the most recent event for each thread. Other similar
          tables contain current events at different levels of the event
          hierarchy: <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a>
          for stage events,
          <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a> for
          statement events, and
          <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a> for
          transaction events.
        </p></li><li class="listitem"><p>
          History tables. These tables have the same structure as the
          current events tables, but contain more rows. For example, for
          wait events, <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a>
          table contains the most recent 10 events per thread.
          <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>
          contains the most recent 10,000 events. Other similar tables
          exist for stage, statement, and transaction histories.
        </p><p>
          To change the sizes of the history tables, set the appropriate
          system variables at server startup. For example, to set the
          sizes of the wait event history tables, set
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_size"><code class="literal">performance_schema_events_waits_history_size</code></a>
          and
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_long_size"><code class="literal">performance_schema_events_waits_history_long_size</code></a>.
        </p></li><li class="listitem"><p>
          Summary tables. These tables contain information aggregated
          over groups of events, including those that have been
          discarded from the history tables.
        </p></li><li class="listitem"><p>
          Instance tables. These tables document what types of objects
          are instrumented. An instrumented object, when used by the
          server, produces an event. These tables provide event names
          and explanatory notes or status information.
        </p></li><li class="listitem"><p>
          Miscellaneous tables. These do not fall into any of the other
          table groups.
</p></li></ul>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-table-index"></a>25.11.1 Performance Schema Table Index</h3>

</div>

</div>

</div>
<p>
        The following table lists each Performance Schema table and
        provides a short description of each one.
</p>
<div class="table">
<a name="performance-schema-tables-table"></a><p class="title"><b>Table 25.1 Performance Schema Tables</b></p>
<div class="table-contents">
<table summary="Performance Schema tables and what information they contain."><col width="55%"><col width="45%"><thead><tr>
            <th scope="col">Table Name</th>
            <th scope="col">Description</th>
          </tr></thead><tbody><tr>
            <td scope="row"><a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a></td>
            <td>Connection statistics per client account</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#cond-instances-table" title="25.11.3.1 The cond_instances Table"><code class="literal">cond_instances</code></a></td>
            <td>synchronization object instances</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a></td>
            <td>Current stage events</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-stages-history-table" title="25.11.5.2 The events_stages_history Table"><code class="literal">events_stages_history</code></a></td>
            <td>Most recent stage events for each thread</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-stages-history-long-table" title="25.11.5.3 The events_stages_history_long Table"><code class="literal">events_stages_history_long</code></a></td>
            <td>Most recent stage events overall</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_account_by_event_name</code></a></td>
            <td>Stage events per account and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_host_by_event_name</code></a></td>
            <td>Stage events per host name and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_thread_by_event_name</code></a></td>
            <td>Stage waits per thread and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_user_by_event_name</code></a></td>
            <td>Stage events per user name and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_global_by_event_name</code></a></td>
            <td>Stage waits per event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a></td>
            <td>Current statement events</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a></td>
            <td>Most recent statement events for each thread</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a></td>
            <td>Most recent statement events overall</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_account_by_event_name</code></a></td>
            <td>Statement events per account and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a></td>
            <td>Statement events per schema and digest value</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_host_by_event_name</code></a></td>
            <td>Statement events per host name and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_program</code></a></td>
            <td>Statement events per stored program</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_thread_by_event_name</code></a></td>
            <td>Statement events per thread and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_user_by_event_name</code></a></td>
            <td>Statement events per user name and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_global_by_event_name</code></a></td>
            <td>Statement events per event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a></td>
            <td>Current transaction events</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-transactions-history-table" title="25.11.7.2 The events_transactions_history Table"><code class="literal">events_transactions_history</code></a></td>
            <td>Most recent transaction events for each thread</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-transactions-history-long-table" title="25.11.7.3 The events_transactions_history_long Table"><code class="literal">events_transactions_history_long</code></a></td>
            <td>Most recent transaction events overall</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_account_by_event_name</code></a></td>
            <td>Transaction events per account and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_host_by_event_name</code></a></td>
            <td>Transaction events per host name and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_thread_by_event_name</code></a></td>
            <td>Transaction events per thread and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_user_by_event_name</code></a></td>
            <td>Transaction events per user name and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_global_by_event_name</code></a></td>
            <td>Transaction events per event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a></td>
            <td>Current wait events</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a></td>
            <td>Most recent wait events for each thread</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a></td>
            <td>Most recent wait events overall</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_waits_summary_by_account_by_event_name</code></a></td>
            <td>Wait events per account and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_waits_summary_by_host_by_event_name</code></a></td>
            <td>Wait events per host name and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_by_instance</code></a></td>
            <td>Wait events per instance</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_by_thread_by_event_name</code></a></td>
            <td>Wait events per thread and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_waits_summary_by_user_by_event_name</code></a></td>
            <td>Wait events per user name and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_global_by_event_name</code></a></td>
            <td>Wait events per event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a></td>
            <td>File instances</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#file-summary-tables" title="25.11.15.6 File I/O Summary Tables"><code class="literal">file_summary_by_event_name</code></a></td>
            <td>File events per event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#file-summary-tables" title="25.11.15.6 File I/O Summary Tables"><code class="literal">file_summary_by_instance</code></a></td>
            <td>File events per file instance</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">global_status</code></a></td>
            <td>Global status variables</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">global_variables</code></a></td>
            <td>Global system variables</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#host-cache-table" title="25.11.16.1 The host_cache Table"><code class="literal">host_cache</code></a></td>
            <td>Information from the internal host cache</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a></td>
            <td>Connection statistics per client host name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_account_by_event_name</code></a></td>
            <td>Memory operations per account and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_host_by_event_name</code></a></td>
            <td>Memory operations per host and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_thread_by_event_name</code></a></td>
            <td>Memory operations per thread and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_user_by_event_name</code></a></td>
            <td>Memory operations per user and event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_global_by_event_name</code></a></td>
            <td>Memory operations globally per event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#metadata-locks-table" title="25.11.12.1 The metadata_locks Table"><code class="literal">metadata_locks</code></a></td>
            <td>Metadata locks and lock requests</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a></td>
            <td>Mutex synchronization object instances</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#objects-summary-global-by-type-table" title="25.11.15.5 Object Wait Summary Table"><code class="literal">objects_summary_global_by_type</code></a></td>
            <td>Object summaries</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a></td>
            <td>Which event timers are available</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a></td>
            <td>Prepared statement instances and statistics</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#replication-applier-configuration-table" title="25.11.11.3 The replication_applier_configuration Table"><code class="literal">replication_applier_configuration</code></a></td>
            <td>Configuration parameters for the transaction applier on the slave</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#replication-applier-status-table" title="25.11.11.4 The replication_applier_status Table"><code class="literal">replication_applier_status</code></a></td>
            <td>Current status of the transaction applier on the slave</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#replication-applier-status-by-coordinator-table" title="25.11.11.5 The replication_applier_status_by_coordinator Table"><code class="literal">replication_applier_status_by_coordinator</code></a></td>
            <td>SQL or coordinator thread applier status</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#replication-applier-status-by-worker-table" title="25.11.11.6 The replication_applier_status_by_worker Table"><code class="literal">replication_applier_status_by_worker</code></a></td>
            <td>Worker thread applier status (empty unless slave is multithreaded)</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#replication-connection-configuration-table" title="25.11.11.1 The replication_connection_configuration Table"><code class="literal">replication_connection_configuration</code></a></td>
            <td>Configuration parameters for connecting to the master</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#replication-connection-status-table" title="25.11.11.2 The replication_connection_status Table"><code class="literal">replication_connection_status</code></a></td>
            <td>Current status of the connection to the master</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#rwlock-instances-table" title="25.11.3.4 The rwlock_instances Table"><code class="literal">rwlock_instances</code></a></td>
            <td>Lock synchronization object instances</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#session-account-connect-attrs-table" title="25.11.9.1 The session_account_connect_attrs Table"><code class="literal">session_account_connect_attrs</code></a></td>
            <td>Connection attributes per for the current session</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#session-connect-attrs-table" title="25.11.9.2 The session_connect_attrs Table"><code class="literal">session_connect_attrs</code></a></td>
            <td>Connection attributes for all sessions</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">session_status</code></a></td>
            <td>Status variables for current session</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">session_variables</code></a></td>
            <td>System variables for current session</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a></td>
            <td>How to initialize monitoring for new foreground threads</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a></td>
            <td>Consumers for which event information can be stored</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a></td>
            <td>Classes of instrumented objects for which events can be collected</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a></td>
            <td>Which objects should be monitored</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a></td>
            <td>Current event timer</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#socket-instances-table" title="25.11.3.5 The socket_instances Table"><code class="literal">socket_instances</code></a></td>
            <td>Active connection instances</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_event_name</code></a></td>
            <td>Socket waits and I/O per event name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_instance</code></a></td>
            <td>Socket waits and I/O per instance</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_account</code></a></td>
            <td>Session status variables per account</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_host</code></a></td>
            <td>Session status variables per host name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">status_by_thread</code></a></td>
            <td>Session status variables per session</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_user</code></a></td>
            <td>Session status variables per user name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#table-handles-table" title="25.11.12.2 The table_handles Table"><code class="literal">table_handles</code></a></td>
            <td>Table locks and lock requests</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#table-io-waits-summary-by-index-usage-table" title="25.11.15.7.2 The table_io_waits_summary_by_index_usage Table"><code class="literal">table_io_waits_summary_by_index_usage</code></a></td>
            <td>Table I/O waits per index</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#table-io-waits-summary-by-table-table" title="25.11.15.7.1 The table_io_waits_summary_by_table Table"><code class="literal">table_io_waits_summary_by_table</code></a></td>
            <td>Table I/O waits per table</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#table-lock-waits-summary-by-table-table" title="25.11.15.7.3 The table_lock_waits_summary_by_table Table"><code class="literal">table_lock_waits_summary_by_table</code></a></td>
            <td>Table lock waits per table</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a></td>
            <td>Information about server threads</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-user-variable-tables" title="25.11.10 Performance Schema User Variable Tables"><code class="literal">user_variables_by_thread</code></a></td>
            <td>User-defined variables per thread</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a></td>
            <td>Connection statistics per client user name</td>
          </tr><tr>
            <td scope="row"><a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">variables_by_thread</code></a></td>
            <td>Session system variables per session</td>
</tr></tbody></table>
</div>

</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-setup-tables"></a>25.11.2 Performance Schema Setup Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#setup-actors-table">25.11.2.1 The setup_actors Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#setup-consumers-table">25.11.2.2 The setup_consumers Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#setup-instruments-table">25.11.2.3 The setup_instruments Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#setup-objects-table">25.11.2.4 The setup_objects Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#setup-timers-table">25.11.2.5 The setup_timers Table</a></span></dt></dl>
</div>
<p>
        The setup tables provide information about the current
        instrumentation and enable the monitoring configuration to be
        changed. For this reason, some columns in these tables can be
        changed if you have the <a class="link" href="security.html#priv_update"><code class="literal">UPDATE</code></a>
        privilege.
      </p><p>
        The use of tables rather than individual variables for setup
        information provides a high degree of flexibility in modifying
        Performance Schema configuration. For example, you can use a
        single statement with standard SQL syntax to make multiple
        simultaneous configuration changes.
      </p><p>
        These setup tables are available:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a>: How to initialize
            monitoring for new foreground threads
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a>: The
            destinations to which event information can be sent and
            stored
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a>: The classes
            of instrumented objects for which events can be collected
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>: Which objects
            should be monitored
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a>: The current event
            timer
</p></li></ul>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="setup-actors-table"></a>25.11.2.1 The setup_actors Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684630178256"></a><a class="indexterm" name="idm139684630176768"></a><p>
          The <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table contains
          information that determines whether to enable monitoring and
          historical event logging for new foreground server threads
          (threads associated with client connections). This table has a
          maximum size of 100 rows by default. To change the table size,
          modify the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_setup_actors_size"><code class="literal">performance_schema_setup_actors_size</code></a>
          system variable at server startup.
        </p><p>
          For each new foreground thread, the Performance Schema matches
          the user and host for the thread against the rows of the
          <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table. If a row from
          that table matches, its <code class="literal">ENABLED</code> and
          <code class="literal">HISTORY</code> column values are used to set the
          the <code class="literal">INSTRUMENTED</code> and
          <code class="literal">HISTORY</code> columns, respectively, of the
          <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table row for the thread.
          This enables instrumenting and historical event logging to be
          applied selectively per host, user, or account (user and host
          combination). If there is no match, the
          <code class="literal">INSTRUMENTED</code> and <code class="literal">HISTORY</code>
          columns for the thread are set to <code class="literal">NO</code>.
        </p><p>
          For background threads, there is no associated user.
          <code class="literal">INSTRUMENTED</code> and <code class="literal">HISTORY</code>
          are <code class="literal">YES</code> by default and
          <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> is not consulted.
        </p><p>
          The initial contents of the
          <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table match any user
          and host combination, so monitoring and historical event
          collection are enabled by default for all foreground threads:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_actors;</code></strong>
+------+------+------+---------+---------+
| HOST | USER | ROLE | ENABLED | HISTORY |
+------+------+------+---------+---------+
| %    | %    | %    | YES     | YES     |
+------+------+------+---------+---------+
</pre><p>
          For information about how to use the
          <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table to affect
          event monitoring, see
          <a class="xref" href="performance-schema.html#performance-schema-thread-filtering" title="25.4.6 Pre-Filtering by Thread">Section 25.4.6, “Pre-Filtering by Thread”</a>.
        </p><p>
          Modifications to the <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a>
          table affect only foreground threads created subsequent to the
          modification, not existing threads. To affect existing
          threads, modify the <code class="literal">INSTRUMENTED</code> and
          <code class="literal">HISTORY</code> columns of
          <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table rows.
        </p><p>
          The <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table has these
          columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">HOST</code>
            </p><p>
              The host name. This should be a literal name, or
              <code class="literal">'%'</code> to mean <span class="quote">“<span class="quote">any host.</span>”</span>
            </p></li><li class="listitem"><p>
              <code class="literal">USER</code>
            </p><p>
              The user name. This should be a literal name, or
              <code class="literal">'%'</code> to mean <span class="quote">“<span class="quote">any user.</span>”</span>
            </p></li><li class="listitem"><p>
              <code class="literal">ROLE</code>
            </p><p>
              Unused.
            </p></li><li class="listitem"><p>
              <code class="literal">ENABLED</code>
            </p><p>
              Whether to enable instrumentation for foreground threads
              matched by the row. The value is <code class="literal">YES</code> or
              <code class="literal">NO</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">HISTORY</code>
            </p><p>
              Whether to log historical events for foreground threads
              matched by the row. The value is <code class="literal">YES</code> or
              <code class="literal">NO</code>.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table. It
          removes the rows.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="setup-consumers-table"></a>25.11.2.2 The setup_consumers Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684630128048"></a><a class="indexterm" name="idm139684630126592"></a><p>
          The <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table lists
          the types of consumers for which event information can be
          stored and which are enabled:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers;</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| events_stages_current            | NO      |
| events_stages_history            | NO      |
| events_stages_history_long       | NO      |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | NO      |
| events_transactions_current      | NO      |
| events_transactions_history      | NO      |
| events_transactions_history_long | NO      |
| events_waits_current             | NO      |
| events_waits_history             | NO      |
| events_waits_history_long        | NO      |
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| statements_digest                | YES     |
+----------------------------------+---------+
</pre><p>
          The consumer settings in the
          <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table form a
          hierarchy from higher levels to lower. For detailed
          information about the effect of enabling different consumers,
          see <a class="xref" href="performance-schema.html#performance-schema-consumer-filtering" title="25.4.7 Pre-Filtering by Consumer">Section 25.4.7, “Pre-Filtering by Consumer”</a>.
        </p><p>
          Modifications to the
          <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table affect
          monitoring immediately.
        </p><p>
          The <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table has
          these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">NAME</code>
            </p><p>
              The consumer name.
            </p></li><li class="listitem"><p>
              <code class="literal">ENABLED</code>
            </p><p>
              Whether the consumer is enabled. The value is
              <code class="literal">YES</code> or <code class="literal">NO</code>. This
              column can be modified. If you disable a consumer, the
              server does not spend time adding event information to it.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="setup-instruments-table"></a>25.11.2.3 The setup_instruments Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684630104080"></a><a class="indexterm" name="idm139684630102624"></a><p>
          The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table lists
          classes of instrumented objects for which events can be
          collected:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments;</code></strong>
+---------------------------------------------------+---------+-------+
| NAME                                              | ENABLED | TIMED |
+---------------------------------------------------+---------+-------+
...
| stage/sql/end                                     | NO      | NO    |
| stage/sql/executing                               | NO      | NO    |
| stage/sql/init                                    | NO      | NO    |
| stage/sql/insert                                  | NO      | NO    |
...
| statement/sql/load                                | YES     | YES   |
| statement/sql/grant                               | YES     | YES   |
| statement/sql/check                               | YES     | YES   |
| statement/sql/flush                               | YES     | YES   |
...
| wait/synch/mutex/sql/LOCK_global_read_lock        | YES     | YES   |
| wait/synch/mutex/sql/LOCK_global_system_variables | YES     | YES   |
| wait/synch/mutex/sql/LOCK_lock_db                 | YES     | YES   |
| wait/synch/mutex/sql/LOCK_manager                 | YES     | YES   |
...
| wait/synch/rwlock/sql/LOCK_grant                  | YES     | YES   |
| wait/synch/rwlock/sql/LOGGER::LOCK_logger         | YES     | YES   |
| wait/synch/rwlock/sql/LOCK_sys_init_connect       | YES     | YES   |
| wait/synch/rwlock/sql/LOCK_sys_init_slave         | YES     | YES   |
...
| wait/io/file/sql/binlog                           | YES     | YES   |
| wait/io/file/sql/binlog_index                     | YES     | YES   |
| wait/io/file/sql/casetest                         | YES     | YES   |
| wait/io/file/sql/dbopt                            | YES     | YES   |
...
</pre><p>
          Each instrument added to the source code provides a row for
          the <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table, even
          when the instrumented code is not executed. When an instrument
          is enabled and executed, instrumented instances are created,
          which are visible in the
          <code class="literal"><em class="replaceable"><code>xxx</code></em>_instances</code>
          tables, such as <a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a> or
          <a class="link" href="performance-schema.html#rwlock-instances-table" title="25.11.3.4 The rwlock_instances Table"><code class="literal">rwlock_instances</code></a>.
        </p><p>
          Modifications to most
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> rows affect
          monitoring immediately. For some instruments, modifications
          are effective only at server startup; changing them at runtime
          has no effect. This affects primarily mutexes, conditions, and
          rwlocks in the server, although there may be other instruments
          for which this is true.
        </p><p>
          For more information about the role of the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table in event
          filtering, see
          <a class="xref" href="performance-schema.html#performance-schema-pre-filtering" title="25.4.3 Event Pre-Filtering">Section 25.4.3, “Event Pre-Filtering”</a>.
        </p><p>
          The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table has
          these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">NAME</code>
            </p><p>
              The instrument name. Instrument names may have multiple
              parts and form a hierarchy, as discussed in
              <a class="xref" href="performance-schema.html#performance-schema-instrument-naming" title="25.6 Performance Schema Instrument Naming Conventions">Section 25.6, “Performance Schema Instrument Naming Conventions”</a>.
              Events produced from execution of an instrument have an
              <code class="literal">EVENT_NAME</code> value that is taken from the
              instrument <code class="literal">NAME</code> value. (Events do not
              really have a <span class="quote">“<span class="quote">name,</span>”</span> but this provides a way
              to associate events with instruments.)
            </p></li><li class="listitem"><p>
              <code class="literal">ENABLED</code>
            </p><p>
              Whether the instrument is enabled. The value is
              <code class="literal">YES</code> or <code class="literal">NO</code>. A
              disabled instrument produces no events. This column can be
              modified, although setting <code class="literal">ENABLED</code> has
              no effect for instruments that have already been created.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMED</code>
            </p><p>
              Whether the instrument is timed. The value is
              <code class="literal">YES</code> or <code class="literal">NO</code>. This
              column can be modified, although setting
              <code class="literal">TIMED</code> has no effect for instruments
              that have already been created.
            </p><p>
              For memory instruments, the <code class="literal">TIMED</code>
              column in <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a>
              is ignored because memory operations are not timed.
            </p><p>
              If an enabled instrument is not timed, the instrument code
              is enabled, but the timer is not. Events produced by the
              instrument have <code class="literal">NULL</code> for the
              <code class="literal">TIMER_START</code>,
              <code class="literal">TIMER_END</code>, and
              <code class="literal">TIMER_WAIT</code> timer values. This in turn
              causes those values to be ignored when calculating the
              sum, minimum, maximum, and average time values in summary
              tables.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="setup-objects-table"></a>25.11.2.4 The setup_objects Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684630059104"></a><a class="indexterm" name="idm139684630057616"></a><p>
          The <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> table controls
          whether the Performance Schema monitors particular objects.
          This table has a maximum size of 100 rows by default. To
          change the table size, modify the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_setup_objects_size"><code class="literal">performance_schema_setup_objects_size</code></a>
          system variable at server startup.
        </p><p>
          The initial <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>
          contents look like this:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_objects;</code></strong>
+-------------+--------------------+-------------+---------+-------+
| OBJECT_TYPE | OBJECT_SCHEMA      | OBJECT_NAME | ENABLED | TIMED |
+-------------+--------------------+-------------+---------+-------+
| EVENT       | mysql              | %           | NO      | NO    |
| EVENT       | performance_schema | %           | NO      | NO    |
| EVENT       | information_schema | %           | NO      | NO    |
| EVENT       | %                  | %           | YES     | YES   |
| FUNCTION    | mysql              | %           | NO      | NO    |
| FUNCTION    | performance_schema | %           | NO      | NO    |
| FUNCTION    | information_schema | %           | NO      | NO    |
| FUNCTION    | %                  | %           | YES     | YES   |
| PROCEDURE   | mysql              | %           | NO      | NO    |
| PROCEDURE   | performance_schema | %           | NO      | NO    |
| PROCEDURE   | information_schema | %           | NO      | NO    |
| PROCEDURE   | %                  | %           | YES     | YES   |
| TABLE       | mysql              | %           | NO      | NO    |
| TABLE       | performance_schema | %           | NO      | NO    |
| TABLE       | information_schema | %           | NO      | NO    |
| TABLE       | %                  | %           | YES     | YES   |
| TRIGGER     | mysql              | %           | NO      | NO    |
| TRIGGER     | performance_schema | %           | NO      | NO    |
| TRIGGER     | information_schema | %           | NO      | NO    |
| TRIGGER     | %                  | %           | YES     | YES   |
+-------------+--------------------+-------------+---------+-------+
</pre><p>
          Modifications to the
          <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> table affect object
          monitoring immediately.
        </p><p>
          For object types listed in
          <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>, the Performance
          Schema uses the table to how to monitor them. Object matching
          is based on the <code class="literal">OBJECT_SCHEMA</code> and
          <code class="literal">OBJECT_NAME</code> columns. Objects for which
          there is no match are not monitored.
        </p><p>
          The effect of the default object configuration is to
          instrument all tables except those in the
          <code class="literal">mysql</code>,
          <code class="literal">INFORMATION_SCHEMA</code>, and
          <code class="literal">performance_schema</code> databases. (Tables in
          the <code class="literal">INFORMATION_SCHEMA</code> database are not
          instrumented regardless of the contents of
          <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>; the row for
          <code class="literal">information_schema.%</code> simply makes this
          default explicit.)
        </p><p>
          When the Performance Schema checks for a match in
          <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>, it tries to find
          more specific matches first. For example, with a table
          <code class="literal">db1.t1</code>, it looks for a match for
          <code class="literal">'db1'</code> and <code class="literal">'t1'</code>, then for
          <code class="literal">'db1'</code> and <code class="literal">'%'</code>, then for
          <code class="literal">'%'</code> and <code class="literal">'%'</code>. The order
          in which matching occurs matters because different matching
          <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> rows can have
          different <code class="literal">ENABLED</code> and
          <code class="literal">TIMED</code> values.
        </p><p>
          Rows can be inserted into or deleted from
          <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> by users with the
          <a class="link" href="security.html#priv_insert"><code class="literal">INSERT</code></a> or
          <a class="link" href="security.html#priv_delete"><code class="literal">DELETE</code></a> privilege on the table.
          For existing rows, only the <code class="literal">ENABLED</code> and
          <code class="literal">TIMED</code> columns can be modified, by users
          with the <a class="link" href="security.html#priv_update"><code class="literal">UPDATE</code></a> privilege on
          the table.
        </p><p>
          For more information about the role of the
          <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> table in event
          filtering, see
          <a class="xref" href="performance-schema.html#performance-schema-pre-filtering" title="25.4.3 Event Pre-Filtering">Section 25.4.3, “Event Pre-Filtering”</a>.
        </p><p>
          The <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> table has these
          columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">OBJECT_TYPE</code>
            </p><p>
              The type of object to instrument. The value is one of
              <code class="literal">'EVENT'</code> (Event Scheduler event),
              <code class="literal">'FUNCTION'</code> (stored function),
              <code class="literal">'PROCEDURE'</code> (stored procedure),
              <code class="literal">'TABLE'</code> (base table), or
              <code class="literal">'TRIGGER'</code> (trigger).
            </p><p>
              <code class="literal">TABLE</code> filtering affects table I/O
              events (<code class="literal">wait/io/table/sql/handler</code>
              instrument) and table lock events
              (<code class="literal">wait/lock/table/sql/handler</code>
              instrument).
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_SCHEMA</code>
            </p><p>
              The schema that contains the object. This should be a
              literal name, or <code class="literal">'%'</code> to mean <span class="quote">“<span class="quote">any
              schema.</span>”</span>
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_NAME</code>
            </p><p>
              The name of the instrumented object. This should be a
              literal name, or <code class="literal">'%'</code> to mean <span class="quote">“<span class="quote">any
              object.</span>”</span>
            </p></li><li class="listitem"><p>
              <code class="literal">ENABLED</code>
            </p><p>
              Whether events for the object are instrumented. The value
              is <code class="literal">YES</code> or <code class="literal">NO</code>. This
              column can be modified.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMED</code>
            </p><p>
              Whether events for the object are timed. The value is
              <code class="literal">YES</code> or <code class="literal">NO</code>. This
              column can be modified.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> table. It
          removes the rows.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="setup-timers-table"></a>25.11.2.5 The setup_timers Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629988720"></a><a class="indexterm" name="idm139684629987232"></a><p>
          The <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table shows the
          currently selected event timers:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_timers;</code></strong>
+-------------+-------------+
| NAME        | TIMER_NAME  |
+-------------+-------------+
| idle        | MICROSECOND |
| wait        | CYCLE       |
| stage       | NANOSECOND  |
| statement   | NANOSECOND  |
| transaction | NANOSECOND  |
+-------------+-------------+
</pre>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">

<div class="admon-title">
Note
</div>
<p>
            As of MySQL 5.7.21, the Performance Schema
            <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table is
            deprecated and is removed in MySQL 8.0, as is the
            <code class="literal">TICKS</code> row in the
            <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a> table.
</p>
</div>
<p>
          The <code class="literal">setup_timers.TIMER_NAME</code> value can be
          changed to select a different timer. The value can be any of
          the values in the
          <code class="literal">performance_timers.TIMER_NAME</code> column. For
          an explanation of how event timing occurs, see
          <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
        </p><p>
          Modifications to the <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a>
          table affect monitoring immediately. Events already in
          progress may use the original timer for the begin time and the
          new timer for the end time. To avoid unpredictable results
          after you make timer changes, use
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> to reset
          Performance Schema statistics.
        </p><p>
          The <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table has these
          columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">NAME</code>
            </p><p>
              The type of instrument the timer is used for.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_NAME</code>
            </p><p>
              The timer that applies to the instrument type. This column
              can be modified.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-instance-tables"></a>25.11.3 Performance Schema Instance Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#cond-instances-table">25.11.3.1 The cond_instances Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#file-instances-table">25.11.3.2 The file_instances Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#mutex-instances-table">25.11.3.3 The mutex_instances Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#rwlock-instances-table">25.11.3.4 The rwlock_instances Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#socket-instances-table">25.11.3.5 The socket_instances Table</a></span></dt></dl>
</div>
<p>
        Instance tables document what types of objects are instrumented.
        They provide event names and explanatory notes or status
        information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#cond-instances-table" title="25.11.3.1 The cond_instances Table"><code class="literal">cond_instances</code></a>: Condition
            synchronization object instances
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a>: File instances
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a>: Mutex
            synchronization object instances
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#rwlock-instances-table" title="25.11.3.4 The rwlock_instances Table"><code class="literal">rwlock_instances</code></a>: Lock
            synchronization object instances
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#socket-instances-table" title="25.11.3.5 The socket_instances Table"><code class="literal">socket_instances</code></a>: Active
            connection instances
</p></li></ul>
</div>
<p>
        These tables list instrumented synchronization objects, files,
        and connections. There are three types of synchronization
        objects: <code class="literal">cond</code>, <code class="literal">mutex</code>, and
        <code class="literal">rwlock</code>. Each instance table has an
        <code class="literal">EVENT_NAME</code> or <code class="literal">NAME</code> column
        to indicate the instrument associated with each row. Instrument
        names may have multiple parts and form a hierarchy, as discussed
        in <a class="xref" href="performance-schema.html#performance-schema-instrument-naming" title="25.6 Performance Schema Instrument Naming Conventions">Section 25.6, “Performance Schema Instrument Naming Conventions”</a>.
      </p><p>
        The <code class="literal">mutex_instances.LOCKED_BY_THREAD_ID</code> and
        <code class="literal">rwlock_instances.WRITE_LOCKED_BY_THREAD_ID</code>
        columns are extremely important for investigating performance
        bottlenecks or deadlocks. For examples of how to use them for
        this purpose, see <a class="xref" href="performance-schema.html#performance-schema-examples" title="25.18 Using the Performance Schema to Diagnose Problems">Section 25.18, “Using the Performance Schema to Diagnose Problems”</a>
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="cond-instances-table"></a>25.11.3.1 The cond_instances Table</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm139684629941872"></a><a class="indexterm" name="idm139684629940416"></a><p>
          The <a class="link" href="performance-schema.html#cond-instances-table" title="25.11.3.1 The cond_instances Table"><code class="literal">cond_instances</code></a> table lists
          all the conditions seen by the Performance Schema while the
          server executes. A condition is a synchronization mechanism
          used in the code to signal that a specific event has happened,
          so that a thread waiting for this condition can resume work.
        </p><p>
          When a thread is waiting for something to happen, the
          condition name is an indication of what the thread is waiting
          for, but there is no immediate way to tell which other thread,
          or threads, will cause the condition to happen.
        </p><p>
          The <a class="link" href="performance-schema.html#cond-instances-table" title="25.11.3.1 The cond_instances Table"><code class="literal">cond_instances</code></a> table has
          these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">NAME</code>
            </p><p>
              The instrument name associated with the condition.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              The address in memory of the instrumented condition.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#cond-instances-table" title="25.11.3.1 The cond_instances Table"><code class="literal">cond_instances</code></a> table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="file-instances-table"></a>25.11.3.2 The file_instances Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629926240"></a><a class="indexterm" name="idm139684629924784"></a><p>
          The <a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a> table lists
          all the files seen by the Performance Schema when executing
          file I/O instrumentation. If a file on disk has never been
          opened, it will not be in
          <a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a>. When a file is
          deleted from the disk, it is also removed from the
          <a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a> table.
        </p><p>
          The <a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a> table has
          these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">FILE_NAME</code>
            </p><p>
              The file name.
            </p></li><li class="listitem"><p>
              <code class="literal">EVENT_NAME</code>
            </p><p>
              The instrument name associated with the file.
            </p></li><li class="listitem"><p>
              <code class="literal">OPEN_COUNT</code>
            </p><p>
              The count of open handles on the file. If a file was
              opened and then closed, it was opened 1 time, but
              <code class="literal">OPEN_COUNT</code> will be 0. To list all the
              files currently opened by the server, use <code class="literal">WHERE
              OPEN_COUNT &gt; 0</code>.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#file-instances-table" title="25.11.3.2 The file_instances Table"><code class="literal">file_instances</code></a> table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="mutex-instances-table"></a>25.11.3.3 The mutex_instances Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629905328"></a><a class="indexterm" name="idm139684629903872"></a><p>
          The <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a> table lists
          all the mutexes seen by the Performance Schema while the
          server executes. A mutex is a synchronization mechanism used
          in the code to enforce that only one thread at a given time
          can have access to some common resource. The resource is said
          to be <span class="quote">“<span class="quote">protected</span>”</span> by the mutex.
        </p><p>
          When two threads executing in the server (for example, two
          user sessions executing a query simultaneously) do need to
          access the same resource (a file, a buffer, or some piece of
          data), these two threads will compete against each other, so
          that the first query to obtain a lock on the mutex will cause
          the other query to wait until the first is done and unlocks
          the mutex.
        </p><p>
          The work performed while holding a mutex is said to be in a
          <span class="quote">“<span class="quote">critical section,</span>”</span> and multiple queries do
          execute this critical section in a serialized way (one at a
          time), which is a potential bottleneck.
        </p><p>
          The <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a> table has
          these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">NAME</code>
            </p><p>
              The instrument name associated with the mutex.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              The address in memory of the instrumented mutex.
            </p></li><li class="listitem"><p>
              <code class="literal">LOCKED_BY_THREAD_ID</code>
            </p><p>
              When a thread currently has a mutex locked,
              <code class="literal">LOCKED_BY_THREAD_ID</code> is the
              <code class="literal">THREAD_ID</code> of the locking thread,
              otherwise it is <code class="literal">NULL</code>.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a> table.
        </p><p>
          For every mutex instrumented in the code, the Performance
          Schema provides the following information.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table
              lists the name of the instrumentation point, with the
              prefix <code class="literal">wait/synch/mutex/</code>.
            </p></li><li class="listitem"><p>
              When some code creates a mutex, a row is added to the
              <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a> table. The
              <code class="literal">OBJECT_INSTANCE_BEGIN</code> column is a
              property that uniquely identifies the mutex.
            </p></li><li class="listitem"><p>
              When a thread attempts to lock a mutex, the
              <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> table
              shows a row for that thread, indicating that it is waiting
              on a mutex (in the <code class="literal">EVENT_NAME</code> column),
              and indicating which mutex is waited on (in the
              <code class="literal">OBJECT_INSTANCE_BEGIN</code> column).
            </p></li><li class="listitem"><p>
              When a thread succeeds in locking a mutex:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>
                  shows that the wait on the mutex is completed (in the
                  <code class="literal">TIMER_END</code> and
                  <code class="literal">TIMER_WAIT</code> columns)
                </p></li><li class="listitem"><p>
                  The completed wait event is added to the
                  <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a> and
                  <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>
                  tables
                </p></li><li class="listitem"><p>
                  <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a> shows
                  that the mutex is now owned by the thread (in the
                  <code class="literal">THREAD_ID</code> column).
</p></li></ul>
</div>
</li><li class="listitem"><p>
              When a thread unlocks a mutex,
              <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a> shows that
              the mutex now has no owner (the
              <code class="literal">THREAD_ID</code> column is
              <code class="literal">NULL</code>).
            </p></li><li class="listitem"><p>
              When a mutex object is destroyed, the corresponding row is
              removed from <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a>.
</p></li></ul>
</div>
<p>
          By performing queries on both of the following tables, a
          monitoring application or a DBA can detect bottlenecks or
          deadlocks between threads that involve mutexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>, to see
              what mutex a thread is waiting for
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#mutex-instances-table" title="25.11.3.3 The mutex_instances Table"><code class="literal">mutex_instances</code></a>, to see which
              other thread currently owns a mutex
</p></li></ul>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="rwlock-instances-table"></a>25.11.3.4 The rwlock_instances Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629851600"></a><a class="indexterm" name="idm139684629850144"></a><p>
          The <a class="link" href="performance-schema.html#rwlock-instances-table" title="25.11.3.4 The rwlock_instances Table"><code class="literal">rwlock_instances</code></a> table lists
          all the <a class="link" href="glossary.html#glos_rw_lock" title="rw-lock">rwlock</a> (read write
          lock) instances seen by the Performance Schema while the
          server executes. An <code class="literal">rwlock</code> is a
          synchronization mechanism used in the code to enforce that
          threads at a given time can have access to some common
          resource following certain rules. The resource is said to be
          <span class="quote">“<span class="quote">protected</span>”</span> by the <code class="literal">rwlock</code>. The
          access is either shared (many threads can have a read lock at
          the same time), exclusive (only one thread can have a write
          lock at a given time), or shared-exclusive (a thread can have
          a write lock while permitting inconsistent reads by other
          threads). Shared-exclusive access is otherwise known as an
          <code class="literal">sxlock</code> and optimizes concurrency and
          improves scalability for read-write workloads.
        </p><p>
          Depending on how many threads are requesting a lock, and the
          nature of the locks requested, access can be either granted in
          shared mode, exclusive mode, shared-exclusive mode or not
          granted at all, waiting for other threads to finish first.
        </p><p>
          The <a class="link" href="performance-schema.html#rwlock-instances-table" title="25.11.3.4 The rwlock_instances Table"><code class="literal">rwlock_instances</code></a> table has
          these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">NAME</code>
            </p><p>
              The instrument name associated with the lock.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              The address in memory of the instrumented lock.
            </p></li><li class="listitem"><p>
              <code class="literal">WRITE_LOCKED_BY_THREAD_ID</code>
            </p><p>
              When a thread currently has an <code class="literal">rwlock</code>
              locked in exclusive (write) mode,
              <code class="literal">WRITE_LOCKED_BY_THREAD_ID</code> is the
              <code class="literal">THREAD_ID</code> of the locking thread,
              otherwise it is <code class="literal">NULL</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">READ_LOCKED_BY_COUNT</code>
            </p><p>
              When a thread currently has an <code class="literal">rwlock</code>
              locked in shared (read) mode,
              <code class="literal">READ_LOCKED_BY_COUNT</code> is incremented by
              1. This is a counter only, so it cannot be used directly
              to find which thread holds a read lock, but it can be used
              to see whether there is a read contention on an
              <code class="literal">rwlock</code>, and see how many readers are
              currently active.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#rwlock-instances-table" title="25.11.3.4 The rwlock_instances Table"><code class="literal">rwlock_instances</code></a> table.
        </p><p>
          By performing queries on both of the following tables, a
          monitoring application or a DBA may detect some bottlenecks or
          deadlocks between threads that involve locks:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>, to see
              what <code class="literal">rwlock</code> a thread is waiting for
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#rwlock-instances-table" title="25.11.3.4 The rwlock_instances Table"><code class="literal">rwlock_instances</code></a>, to see
              which other thread currently owns an
              <code class="literal">rwlock</code>
</p></li></ul>
</div>
<p>
          There is a limitation: The
          <a class="link" href="performance-schema.html#rwlock-instances-table" title="25.11.3.4 The rwlock_instances Table"><code class="literal">rwlock_instances</code></a> can be used only
          to identify the thread holding a write lock, but not the
          threads holding a read lock.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="socket-instances-table"></a>25.11.3.5 The socket_instances Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629814432"></a><a class="indexterm" name="idm139684629812976"></a><a class="indexterm" name="idm139684629811488"></a><a class="indexterm" name="idm139684629810416"></a><p>
          The <a class="link" href="performance-schema.html#socket-instances-table" title="25.11.3.5 The socket_instances Table"><code class="literal">socket_instances</code></a> table
          provides a real-time snapshot of the active connections to the
          MySQL server. The table contains one row per TCP/IP or Unix
          socket file connection. Information available in this table
          provides a real-time snapshot of the active connections to the
          server. (Additional information is available in socket summary
          tables, including network activity such as socket operations
          and number of bytes transmitted and received; see
          <a class="xref" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables">Section 25.11.15.8, “Socket Summary Tables”</a>).
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM socket_instances\G</code></strong>
*************************** 1. row ***************************
           EVENT_NAME: wait/io/socket/sql/server_unix_socket
OBJECT_INSTANCE_BEGIN: 4316619408
            THREAD_ID: 1
            SOCKET_ID: 16
                   IP:
                 PORT: 0
                STATE: ACTIVE
*************************** 2. row ***************************
           EVENT_NAME: wait/io/socket/sql/client_connection
OBJECT_INSTANCE_BEGIN: 4316644608
            THREAD_ID: 21
            SOCKET_ID: 39
                   IP: 127.0.0.1
                 PORT: 55233
                STATE: ACTIVE
*************************** 3. row ***************************
           EVENT_NAME: wait/io/socket/sql/server_tcpip_socket
OBJECT_INSTANCE_BEGIN: 4316699040
            THREAD_ID: 1
            SOCKET_ID: 14
                   IP: 0.0.0.0
                 PORT: 50603
                STATE: ACTIVE
</pre><p>
          Socket instruments have names of the form
          <code class="literal">wait/io/socket/sql/<em class="replaceable"><code>socket_type</code></em></code>
          and are used like this:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1"><li class="listitem"><p>
              The server has a listening socket for each network
              protocol that it supports. The instruments associated with
              listening sockets for TCP/IP or Unix socket file
              connections have a <em class="replaceable"><code>socket_type</code></em>
              value of <code class="literal">server_tcpip_socket</code> or
              <code class="literal">server_unix_socket</code>, respectively.
            </p></li><li class="listitem"><p>
              When a listening socket detects a connection, the server
              transfers the connection to a new socket managed by a
              separate thread. The instrument for the new connection
              thread has a <em class="replaceable"><code>socket_type</code></em> value
              of <code class="literal">client_connection</code>.
            </p></li><li class="listitem"><p>
              When a connection terminates, the row in
              <a class="link" href="performance-schema.html#socket-instances-table" title="25.11.3.5 The socket_instances Table"><code class="literal">socket_instances</code></a>
              corresponding to it is deleted.
</p></li></ol>
</div>
<p>
          The <a class="link" href="performance-schema.html#socket-instances-table" title="25.11.3.5 The socket_instances Table"><code class="literal">socket_instances</code></a> table has
          these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">EVENT_NAME</code>
            </p><p>
              The name of the <code class="literal">wait/io/socket/*</code>
              instrument that produced the event. This is a
              <code class="literal">NAME</code> value from the
              <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
              Instrument names may have multiple parts and form a
              hierarchy, as discussed in
              <a class="xref" href="performance-schema.html#performance-schema-instrument-naming" title="25.6 Performance Schema Instrument Naming Conventions">Section 25.6, “Performance Schema Instrument Naming Conventions”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              This column uniquely identifies the socket. The value is
              the address of an object in memory.
            </p></li><li class="listitem"><p>
              <code class="literal">THREAD_ID</code>
            </p><p>
              The internal thread identifier assigned by the server.
              Each socket is managed by a single thread, so each socket
              can be mapped to a thread which can be mapped to a server
              process.
            </p></li><li class="listitem"><p>
              <code class="literal">SOCKET_ID</code>
            </p><p>
              The internal file handle assigned to the socket.
            </p></li><li class="listitem"><p>
              <code class="literal">IP</code>
            </p><p>
              The client IP address. The value may be either an IPv4 or
              IPv6 address, or blank to indicate a Unix socket file
              connection.
            </p></li><li class="listitem"><p>
              <code class="literal">PORT</code>
            </p><p>
              The TCP/IP port number, in the range from 0 to 65535.
            </p></li><li class="listitem"><p>
              <code class="literal">STATE</code>
            </p><p>
              The socket status, either <code class="literal">IDLE</code> or
              <code class="literal">ACTIVE</code>. Wait times for active sockets
              are tracked using the corresponding socket instrument.
              Wait times for idle sockets are tracked using the
              <code class="literal">idle</code> instrument.
            </p><p>
              A socket is idle if it is waiting for a request from the
              client. When a socket becomes idle, the event row in
              <a class="link" href="performance-schema.html#socket-instances-table" title="25.11.3.5 The socket_instances Table"><code class="literal">socket_instances</code></a> that is
              tracking the socket switches from a status of
              <code class="literal">ACTIVE</code> to <code class="literal">IDLE</code>. The
              <code class="literal">EVENT_NAME</code> value remains
              <code class="literal">wait/io/socket/*</code>, but timing for the
              instrument is suspended. Instead, an event is generated in
              the <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>
              table with an <code class="literal">EVENT_NAME</code> value of
              <code class="literal">idle</code>.
            </p><p>
              When the next request is received, the
              <code class="literal">idle</code> event terminates, the socket
              instance switches from <code class="literal">IDLE</code> to
              <code class="literal">ACTIVE</code>, and timing of the socket
              instrument resumes.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#socket-instances-table" title="25.11.3.5 The socket_instances Table"><code class="literal">socket_instances</code></a> table.
        </p><p>
          The <code class="literal">IP:PORT</code> column combination value
          identifies the connection. This combination value is used in
          the <code class="literal">OBJECT_NAME</code> column of the
          <code class="literal">events_waits_<em class="replaceable"><code>xxx</code></em></code>
          tables, to identify the connection from which socket events
          come:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              For the Unix domain listener socket
              (<code class="literal">server_unix_socket</code>), the port is 0,
              and the IP is <code class="literal">''</code>.
            </p></li><li class="listitem"><p>
              For client connections via the Unix domain listener
              (<code class="literal">client_connection</code>), the port is 0, and
              the IP is <code class="literal">''</code>.
            </p></li><li class="listitem"><p>
              For the TCP/IP server listener socket
              (<code class="literal">server_tcpip_socket</code>), the port is
              always the master port (for example, 3306), and the IP is
              always <code class="literal">0.0.0.0</code>.
            </p></li><li class="listitem"><p>
              For client connections via the TCP/IP listener
              (<code class="literal">client_connection</code>), the port is
              whatever the server assigns, but never 0. The IP is the IP
              of the originating host (<code class="literal">127.0.0.1</code> or
              <code class="literal">::1</code> for the local host)
</p></li></ul>
</div>

</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-wait-tables"></a>25.11.4 Performance Schema Wait Event Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#events-waits-current-table">25.11.4.1 The events_waits_current Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#events-waits-history-table">25.11.4.2 The events_waits_history Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#events-waits-history-long-table">25.11.4.3 The events_waits_history_long Table</a></span></dt></dl>
</div>
<p>
        The Performance Schema instruments waits, which are events that
        take time. Within the event hierarchy, wait events nest within
        stage events, which nest within statement events, which nest
        within transaction events.
      </p><p>
        These tables store wait events:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>: Current
            wait events
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a>: The most
            recent wait events per thread
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>: The
            most recent wait events globally (across all threads)
</p></li></ul>
</div>
<p>
        The following sections describe the wait event tables. There are
        also summary tables that aggregate information about wait
        events; see <a class="xref" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables">Section 25.11.15.1, “Wait Event Summary Tables”</a>.
</p>
<h4><a name="wait-event-configuration"></a>Wait Event Configuration</h4>
<p>
        To control collection of wait events, set the state of the
        relevant instruments and consumers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table
            contains instruments with names that begin with
            <code class="literal">wait</code>. Use these instruments to enable or
            disable collection of wait events.
          </p></li><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table
            contains consumer values with names corresponding to the
            current and recent wait event table names. Use these
            consumers to filter collection of wait events.
</p></li></ul>
</div>
<p>
        Some wait instruments are enabled by default; others are
        disabled. For example:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments</code></strong>
       <strong class="userinput"><code>WHERE NAME LIKE 'wait/io/file/innodb%';</code></strong>
+--------------------------------------+---------+-------+
| NAME                                 | ENABLED | TIMED |
+--------------------------------------+---------+-------+
| wait/io/file/innodb/innodb_data_file | YES     | YES   |
| wait/io/file/innodb/innodb_log_file  | YES     | YES   |
| wait/io/file/innodb/innodb_temp_file | YES     | YES   |
+--------------------------------------+---------+-------+
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments WHERE</code></strong>
       <strong class="userinput"><code>NAME LIKE 'wait/io/socket/%';</code></strong>
+----------------------------------------+---------+-------+
| NAME                                   | ENABLED | TIMED |
+----------------------------------------+---------+-------+
| wait/io/socket/sql/server_tcpip_socket | NO      | NO    |
| wait/io/socket/sql/server_unix_socket  | NO      | NO    |
| wait/io/socket/sql/client_connection   | NO      | NO    |
+----------------------------------------+---------+-------+
</pre><p>
        The wait consumers are disabled by default:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers WHERE NAME LIKE '%waits%';</code></strong>
+---------------------------+---------+
| NAME                      | ENABLED |
+---------------------------+---------+
| events_waits_current      | NO      |
| events_waits_history      | NO      |
| events_waits_history_long | NO      |
+---------------------------+---------+
</pre><p>
        To control wait event collection at server startup, use lines
        like these in your <code class="filename">my.cnf</code> file:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Enable:
          </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='wait/%=ON'
performance-schema-consumer-events-waits-current=ON
performance-schema-consumer-events-waits-history=ON
performance-schema-consumer-events-waits-history-long=ON
</pre></li><li class="listitem"><p>
            Disable:
          </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='wait/%=OFF'
performance-schema-consumer-events-waits-current=OFF
performance-schema-consumer-events-waits-history=OFF
performance-schema-consumer-events-waits-history-long=OFF
</pre></li></ul>
</div>
<p>
        To control wait event collection at runtime, update the
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> and
        <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Enable:
          </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'YES', TIMED = 'YES'
WHERE NAME = 'wait/%';
UPDATE setup_consumers SET ENABLED = 'YES'
WHERE NAME LIKE '%waits%';
</pre></li><li class="listitem"><p>
            Disable:
          </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'NO', TIMED = 'NO'
WHERE NAME = 'wait/%';
UPDATE setup_consumers SET ENABLED = 'NO'
WHERE NAME LIKE '%waits%';
</pre></li></ul>
</div>
<p>
        To collect only specific wait events, enable only the
        corresponding wait instruments. To collect wait events only for
        specific wait event tables, enable the wait instruments but only
        the wait consumers corresponding to the desired tables.
      </p><p>
        The <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table contains a
        row with a <code class="literal">NAME</code> value of
        <code class="literal">wait</code> that indicates the unit for wait event
        timing. The default unit is <code class="literal">CYCLE</code>:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_timers WHERE NAME = 'wait';</code></strong>
+------+------------+
| NAME | TIMER_NAME |
+------+------------+
| wait | CYCLE      |
+------+------------+
</pre><p>
        To change the timing unit, modify the
        <code class="literal">TIMER_NAME</code> value:
      </p><pre data-lang="sql" class="programlisting">
UPDATE setup_timers SET TIMER_NAME = 'NANOSECOND'
WHERE NAME = 'wait';
</pre><p>
        For additional information about configuring event collection,
        see <a class="xref" href="performance-schema.html#performance-schema-startup-configuration" title="25.3 Performance Schema Startup Configuration">Section 25.3, “Performance Schema Startup Configuration”</a>,
        and <a class="xref" href="performance-schema.html#performance-schema-runtime-configuration" title="25.4 Performance Schema Runtime Configuration">Section 25.4, “Performance Schema Runtime Configuration”</a>.
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-waits-current-table"></a>25.11.4.1 The events_waits_current Table</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm139684629694672"></a><a class="indexterm" name="idm139684629693168"></a><p>
          The <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> table
          contains current wait events, one row per thread showing the
          current status of the thread's most recent monitored wait
          event.
        </p><p>
          Of the tables that contain wait event rows,
          <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> is the most
          fundamental. Other tables that contain wait event rows are
          logically derived from the current events. For example, the
          <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a> and
          <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a> tables
          are collections of the most recent wait events, up to a fixed
          number of rows.
        </p><p>
          For information about configuration of wait event collection,
          see <a class="xref" href="performance-schema.html#performance-schema-wait-tables" title="25.11.4 Performance Schema Wait Event Tables">Section 25.11.4, “Performance Schema Wait Event Tables”</a>.
        </p><p>
          The <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> table
          has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">THREAD_ID</code>, <code class="literal">EVENT_ID</code>
            </p><p>
              The thread associated with the event and the thread
              current event number when the event starts. The
              <code class="literal">THREAD_ID</code> and
              <code class="literal">EVENT_ID</code> values taken together uniquely
              identify the row. No two rows have the same pair of
              values.
            </p></li><li class="listitem"><p>
              <code class="literal">END_EVENT_ID</code>
            </p><p>
              This column is set to <code class="literal">NULL</code> when the
              event starts and updated to the thread current event
              number when the event ends.
            </p></li><li class="listitem"><p>
              <code class="literal">EVENT_NAME</code>
            </p><p>
              The name of the instrument that produced the event. This
              is a <code class="literal">NAME</code> value from the
              <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
              Instrument names may have multiple parts and form a
              hierarchy, as discussed in
              <a class="xref" href="performance-schema.html#performance-schema-instrument-naming" title="25.6 Performance Schema Instrument Naming Conventions">Section 25.6, “Performance Schema Instrument Naming Conventions”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">SOURCE</code>
            </p><p>
              The name of the source file containing the instrumented
              code that produced the event and the line number in the
              file at which the instrumentation occurs. This enables you
              to check the source to determine exactly what code is
              involved. For example, if a mutex or lock is being
              blocked, you can check the context in which this occurs.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_START</code>,
              <code class="literal">TIMER_END</code>,
              <code class="literal">TIMER_WAIT</code>
            </p><p>
              Timing information for the event. The unit for these
              values is picoseconds (trillionths of a second). The
              <code class="literal">TIMER_START</code> and
              <code class="literal">TIMER_END</code> values indicate when event
              timing started and ended. <code class="literal">TIMER_WAIT</code> is
              the event elapsed time (duration).
            </p><p>
              If an event has not finished, <code class="literal">TIMER_END</code>
              is the current timer value and
              <code class="literal">TIMER_WAIT</code> is the time elapsed so far
              (<code class="literal">TIMER_END</code> −
              <code class="literal">TIMER_START</code>).
            </p><p>
              If an event is produced from an instrument that has
              <code class="literal">TIMED = NO</code>, timing information is not
              collected, and <code class="literal">TIMER_START</code>,
              <code class="literal">TIMER_END</code>, and
              <code class="literal">TIMER_WAIT</code> are all
              <code class="literal">NULL</code>.
            </p><p>
              For discussion of picoseconds as the unit for event times
              and factors that affect time values, see
              <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">SPINS</code>
            </p><p>
              For a mutex, the number of spin rounds. If the value is
              <code class="literal">NULL</code>, the code does not use spin rounds
              or spinning is not instrumented.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_SCHEMA</code>,
              <code class="literal">OBJECT_NAME</code>,
              <code class="literal">OBJECT_TYPE</code>,
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              These columns identify the object <span class="quote">“<span class="quote">being acted
              on.</span>”</span> What that means depends on the object type.
            </p><p>
              For a synchronization object (<code class="literal">cond</code>,
              <code class="literal">mutex</code>, <code class="literal">rwlock</code>):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  <code class="literal">OBJECT_SCHEMA</code>,
                  <code class="literal">OBJECT_NAME</code>, and
                  <code class="literal">OBJECT_TYPE</code> are
                  <code class="literal">NULL</code>.
                </p></li><li class="listitem"><p>
                  <code class="literal">OBJECT_INSTANCE_BEGIN</code> is the
                  address of the synchronization object in memory.
</p></li></ul>
</div>
<p>
              For a file I/O object:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  <code class="literal">OBJECT_SCHEMA</code> is
                  <code class="literal">NULL</code>.
                </p></li><li class="listitem"><p>
                  <code class="literal">OBJECT_NAME</code> is the file name.
                </p></li><li class="listitem"><p>
                  <code class="literal">OBJECT_TYPE</code> is
                  <code class="literal">FILE</code>.
                </p></li><li class="listitem"><p>
                  <code class="literal">OBJECT_INSTANCE_BEGIN</code> is an address
                  in memory.
</p></li></ul>
</div>
<p>
              For a socket object:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  <code class="literal">OBJECT_NAME</code> is the
                  <code class="literal">IP:PORT</code> value for the socket.
                </p></li><li class="listitem"><p>
                  <code class="literal">OBJECT_INSTANCE_BEGIN</code> is an address
                  in memory.
</p></li></ul>
</div>
<p>
              For a table I/O object:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  <code class="literal">OBJECT_SCHEMA</code> is the name of the
                  schema that contains the table.
                </p></li><li class="listitem"><p>
                  <code class="literal">OBJECT_NAME</code> is the table name.
                </p></li><li class="listitem"><p>
                  <code class="literal">OBJECT_TYPE</code> is
                  <code class="literal">TABLE</code> for a persistent base table
                  or <code class="literal">TEMPORARY TABLE</code> for a temporary
                  table.
                </p></li><li class="listitem"><p>
                  <code class="literal">OBJECT_INSTANCE_BEGIN</code> is an address
                  in memory.
</p></li></ul>
</div>
<p>
              An <code class="literal">OBJECT_INSTANCE_BEGIN</code> value itself
              has no meaning, except that different values indicate
              different objects.
              <code class="literal">OBJECT_INSTANCE_BEGIN</code> can be used for
              debugging. For example, it can be used with <code class="literal">GROUP
              BY OBJECT_INSTANCE_BEGIN</code> to see whether the load
              on 1,000 mutexes (that protect, say, 1,000 pages or blocks
              of data) is spread evenly or just hitting a few
              bottlenecks. This can help you correlate with other
              sources of information if you see the same object address
              in a log file or another debugging or performance tool.
            </p></li><li class="listitem"><p>
              <code class="literal">INDEX_NAME</code>
            </p><p>
              The name of the index used. <code class="literal">PRIMARY</code>
              indicates the table primary index. <code class="literal">NULL</code>
              means that no index was used.
            </p></li><li class="listitem"><p>
              <code class="literal">NESTING_EVENT_ID</code>
            </p><p>
              The <code class="literal">EVENT_ID</code> value of the event within
              which this event is nested.
            </p></li><li class="listitem"><p>
              <code class="literal">NESTING_EVENT_TYPE</code>
            </p><p>
              The nesting event type. The value is
              <code class="literal">TRANSACTION</code>,
              <code class="literal">STATEMENT</code>, <code class="literal">STAGE</code>, or
              <code class="literal">WAIT</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">OPERATION</code>
            </p><p>
              The type of operation performed, such as
              <code class="literal">lock</code>, <code class="literal">read</code>, or
              <code class="literal">write</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">NUMBER_OF_BYTES</code>
            </p><p>
              The number of bytes read or written by the operation. For
              table I/O waits (events for the
              <code class="literal">wait/io/table/sql/handler</code> instrument),
              <code class="literal">NUMBER_OF_BYTES</code> indicates the number of
              rows. If the value is greater than 1, the event is for a
              batch I/O operation. The following discussion describes
              the difference between exclusively single-row reporting
              and reporting that reflects batch I/O.
            </p><p>
              MySQL executes joins using a nested-loop implementation.
              The job of the Performance Schema instrumentation is to
              provide row count and accumulated execution time per table
              in the join. Assume a join query of the following form
              that is executed using a table join order of
              <code class="literal">t1</code>, <code class="literal">t2</code>,
              <code class="literal">t3</code>:
            </p><pre data-lang="sql" class="programlisting">
SELECT ... FROM t1 JOIN t2 ON ... JOIN t3 ON ...
</pre><p>
              Table <span class="quote">“<span class="quote">fanout</span>”</span> is the increase or decrease in
              number of rows from adding a table during join processing.
              If the fanout for table <code class="literal">t3</code> is greater
              than 1, the majority of row-fetch operations are for that
              table. Suppose that the join accesses 10 rows from
              <code class="literal">t1</code>, 20 rows from <code class="literal">t2</code>
              per row from <code class="literal">t1</code>, and 30 rows from
              <code class="literal">t3</code> per row of table
              <code class="literal">t2</code>. With single-row reporting, the
              total number of instrumented operations is:
            </p><pre data-lang="clike" class="programlisting">
10 + (10 * 20) + (10 * 20 * 30) = 6210
</pre><p>
              A significant reduction in the number of instrumented
              operations is achievable by aggregating them per scan
              (that is, per unique combination of rows from
              <code class="literal">t1</code> and <code class="literal">t2</code>). With
              batch I/O reporting, the Performance Schema produces an
              event for each scan of the innermost table
              <code class="literal">t3</code> rather than for each row, and the
              number of instrumented row operations reduces to:
            </p><pre data-lang="clike" class="programlisting">
10 + (10 * 20) + (10 * 20) = 410
</pre><p>
              That is a reduction of 93%, illustrating how the
              batch-reporting strategy significantly reduces Performance
              Schema overhead for table I/O by reducing the number of
              reporting calls. The tradeoff is lesser accuracy for event
              timing. Rather than time for an individual row operation
              as in per-row reporting, timing for batch I/O includes
              time spent for operations such as join buffering,
              aggregation, and returning rows to the client.
            </p><p>
              For batch I/O reporting to occur, these conditions must be
              true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  Query execution accesses the innermost table of a
                  query block (for a single-table query, that table
                  counts as innermost)
                </p></li><li class="listitem"><p>
                  Query execution does not request a single row from the
                  table (so, for example,
                  <a class="link" href="optimization.html#jointype_eq_ref"><code class="literal">eq_ref</code></a> access
                  prevents use of batch reporting)
                </p></li><li class="listitem"><p>
                  Query execution does not evaluate a subquery
                  containing table access for the table
</p></li></ul>
</div>
</li><li class="listitem"><p>
              <code class="literal">FLAGS</code>
            </p><p>
              Reserved for future use.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> table.
          It removes the rows.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-waits-history-table"></a>25.11.4.2 The events_waits_history Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629568288"></a><a class="indexterm" name="idm139684629566784"></a><p>
          The <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a> table
          contains the most recent <em class="replaceable"><code>N</code></em> wait
          events per thread. The value of <em class="replaceable"><code>N</code></em>
          is autosized at server startup. To set the table size
          explicitly, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_size"><code class="literal">performance_schema_events_waits_history_size</code></a>
          system variable at server startup. Wait events are not added
          to the table until they have ended. As new events are added,
          older events are discarded if the table is full.
        </p><p>
          The <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a> table
          has the same structure as
          <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>. See
          <a class="xref" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table">Section 25.11.4.1, “The events_waits_current Table”</a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a> table.
          It removes the rows.
        </p><p>
          For information about configuration of wait event collection,
          see <a class="xref" href="performance-schema.html#performance-schema-wait-tables" title="25.11.4 Performance Schema Wait Event Tables">Section 25.11.4, “Performance Schema Wait Event Tables”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-waits-history-long-table"></a>25.11.4.3 The events_waits_history_long Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629552016"></a><a class="indexterm" name="idm139684629550512"></a><p>
          The <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>
          table contains the most recent <em class="replaceable"><code>N</code></em>
          wait events. The value of <em class="replaceable"><code>N</code></em> is
          autosized at server startup. To set the table size explicitly,
          set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_long_size"><code class="literal">performance_schema_events_waits_history_long_size</code></a>
          system variable at server startup. Wait events are not added
          to the table until they have ended. As new events are added,
          older events are discarded if the table is full. When a thread
          ends, its rows are removed from the table.
        </p><p>
          The <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>
          table has the same structure as
          <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>. See
          <a class="xref" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table">Section 25.11.4.1, “The events_waits_current Table”</a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>
          table. It removes the rows.
        </p><p>
          For information about configuration of wait event collection,
          see <a class="xref" href="performance-schema.html#performance-schema-wait-tables" title="25.11.4 Performance Schema Wait Event Tables">Section 25.11.4, “Performance Schema Wait Event Tables”</a>.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-stage-tables"></a>25.11.5 Performance Schema Stage Event Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#events-stages-current-table">25.11.5.1 The events_stages_current Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#events-stages-history-table">25.11.5.2 The events_stages_history Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#events-stages-history-long-table">25.11.5.3 The events_stages_history_long Table</a></span></dt></dl>
</div>
<p>
        The Performance Schema instruments stages, which are steps
        during the statement-execution process, such as parsing a
        statement, opening a table, or performing a
        <code class="literal">filesort</code> operation. Stages correspond to the
        thread states displayed by <a class="link" href="sql-syntax.html#show-processlist" title="13.7.5.29 SHOW PROCESSLIST Syntax"><code class="literal">SHOW
        PROCESSLIST</code></a> or that are visible in the
        <a class="link" href="information-schema.html#processlist-table" title="24.18 The INFORMATION_SCHEMA PROCESSLIST Table"><code class="literal">INFORMATION_SCHEMA.PROCESSLIST</code></a>
        table. Stages begin and end when state values change.
      </p><p>
        Within the event hierarchy, wait events nest within stage
        events, which nest within statement events, which nest within
        transaction events.
      </p><p>
        These tables store stage events:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a>: Current
            stage events
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-stages-history-table" title="25.11.5.2 The events_stages_history Table"><code class="literal">events_stages_history</code></a>: The most
            recent stage events per thread
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-stages-history-long-table" title="25.11.5.3 The events_stages_history_long Table"><code class="literal">events_stages_history_long</code></a>: The
            most recent stage events globally (across all threads)
</p></li></ul>
</div>
<p>
        The following sections describe the stage event tables. There
        are also summary tables that aggregate information about stage
        events; see <a class="xref" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables">Section 25.11.15.2, “Stage Summary Tables”</a>.
</p>
<h4><a name="stage-event-configuration"></a>Stage Event Configuration</h4>
<p>
        To control collection of stage events, set the state of the
        relevant instruments and consumers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table
            contains instruments with names that begin with
            <code class="literal">stage</code>. Use these instruments to enable or
            disable collection of stage events.
          </p></li><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table
            contains consumer values with names corresponding to the
            current and recent stage event table names. Use these
            consumers to filter collection of stage events.
</p></li></ul>
</div>
<p>
        Other than those instruments that provide statement progress
        information, the stage instruments are disabled by default. For
        example:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments WHERE NAME RLIKE 'stage/sql/[a-c]';</code></strong>
+----------------------------------------------------+---------+-------+
| NAME                                               | ENABLED | TIMED |
+----------------------------------------------------+---------+-------+
| stage/sql/After create                             | NO      | NO    |
| stage/sql/allocating local table                   | NO      | NO    |
| stage/sql/altering table                           | NO      | NO    |
| stage/sql/committing alter table to storage engine | NO      | NO    |
| stage/sql/Changing master                          | NO      | NO    |
| stage/sql/Checking master version                  | NO      | NO    |
| stage/sql/checking permissions                     | NO      | NO    |
| stage/sql/checking privileges on cached query      | NO      | NO    |
| stage/sql/checking query cache for query           | NO      | NO    |
| stage/sql/cleaning up                              | NO      | NO    |
| stage/sql/closing tables                           | NO      | NO    |
| stage/sql/Connecting to master                     | NO      | NO    |
| stage/sql/converting HEAP to MyISAM                | NO      | NO    |
| stage/sql/Copying to group table                   | NO      | NO    |
| stage/sql/Copying to tmp table                     | NO      | NO    |
| stage/sql/copy to tmp table                        | NO      | NO    |
| stage/sql/Creating sort index                      | NO      | NO    |
| stage/sql/creating table                           | NO      | NO    |
| stage/sql/Creating tmp table                       | NO      | NO    |
+----------------------------------------------------+---------+-------+
</pre><p>
        Stage event instruments that provide statement progress
        information are enabled and timed by default:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments WHERE</code></strong>
       <strong class="userinput"><code>ENABLED='YES' AND NAME LIKE "stage/%";</code></strong>
+------------------------------------------------------+---------+-------+
| NAME                                                 | ENABLED | TIMED |
+------------------------------------------------------+---------+-------+
| stage/sql/copy to tmp table                          | YES     | YES   |
| stage/innodb/alter table (end)                       | YES     | YES   |
| stage/innodb/alter table (flush)                     | YES     | YES   |
| stage/innodb/alter table (insert)                    | YES     | YES   |
| stage/innodb/alter table (log apply index)           | YES     | YES   |
| stage/innodb/alter table (log apply table)           | YES     | YES   |
| stage/innodb/alter table (merge sort)                | YES     | YES   |
| stage/innodb/alter table (read PK and internal sort) | YES     | YES   |
| stage/innodb/buffer pool load                        | YES     | YES   |
+------------------------------------------------------+---------+-------+
</pre><p>
        The stage consumers are disabled by default:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers WHERE NAME LIKE '%stages%';</code></strong>
+----------------------------+---------+
| NAME                       | ENABLED |
+----------------------------+---------+
| events_stages_current      | NO      |
| events_stages_history      | NO      |
| events_stages_history_long | NO      |
+----------------------------+---------+
</pre><p>
        To control stage event collection at server startup, use lines
        like these in your <code class="filename">my.cnf</code> file:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Enable:
          </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='stage/%=ON'
performance-schema-consumer-events-stages-current=ON
performance-schema-consumer-events-stages-history=ON
performance-schema-consumer-events-stages-history-long=ON
</pre></li><li class="listitem"><p>
            Disable:
          </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='stage/%=OFF'
performance-schema-consumer-events-stages-current=OFF
performance-schema-consumer-events-stages-history=OFF
performance-schema-consumer-events-stages-history-long=OFF
</pre></li></ul>
</div>
<p>
        To control stage event collection at runtime, update the
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> and
        <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Enable:
          </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'YES', TIMED = 'YES'
WHERE NAME = 'stage/%';
UPDATE setup_consumers SET ENABLED = 'YES'
WHERE NAME LIKE '%stages%';
</pre></li><li class="listitem"><p>
            Disable:
          </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'NO', TIMED = 'NO'
WHERE NAME = 'stage/%';
UPDATE setup_consumers SET ENABLED = 'NO'
WHERE NAME LIKE '%stages%';
</pre></li></ul>
</div>
<p>
        To collect only specific stage events, enable only the
        corresponding stage instruments. To collect stage events only
        for specific stage event tables, enable the stage instruments
        but only the stage consumers corresponding to the desired
        tables.
      </p><p>
        The <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table contains a
        row with a <code class="literal">NAME</code> value of
        <code class="literal">stage</code> that indicates the unit for stage event
        timing. The default unit is <code class="literal">NANOSECOND</code>:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_timers WHERE NAME = 'stage';</code></strong>
+-------+------------+
| NAME  | TIMER_NAME |
+-------+------------+
| stage | NANOSECOND |
+-------+------------+
</pre><p>
        To change the timing unit, modify the
        <code class="literal">TIMER_NAME</code> value:
      </p><pre data-lang="sql" class="programlisting">
UPDATE setup_timers SET TIMER_NAME = 'MICROSECOND'
WHERE NAME = 'stage';
</pre><p>
        For additional information about configuring event collection,
        see <a class="xref" href="performance-schema.html#performance-schema-startup-configuration" title="25.3 Performance Schema Startup Configuration">Section 25.3, “Performance Schema Startup Configuration”</a>,
        and <a class="xref" href="performance-schema.html#performance-schema-runtime-configuration" title="25.4 Performance Schema Runtime Configuration">Section 25.4, “Performance Schema Runtime Configuration”</a>.
</p>
<h4><a name="stage-event-progress"></a>Stage Event Progress Information</h4>
<p>
        The Performance Schema stage event tables contain two columns
        that, taken together, provide a stage progress indicator for
        each row:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">WORK_COMPLETED</code>: The number of work units
            completed for the stage
          </p></li><li class="listitem"><p>
            <code class="literal">WORK_ESTIMATED</code>: The number of work units
            expected for the stage
</p></li></ul>
</div>
<p>
        Each column is <code class="literal">NULL</code> if no progress
        information is provided for an instrument. Interpretation of the
        information, if it is available, depends entirely on the
        instrument implementation. The Performance Schema tables provide
        a container to store progress data, but make no assumptions
        about the semantics of the metric itself:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            A <span class="quote">“<span class="quote">work unit</span>”</span> is an integer metric that
            increases over time during execution, such as the number of
            bytes, rows, files, or tables processed. The definition of
            <span class="quote">“<span class="quote">work unit</span>”</span> for a particular instrument is left
            to the instrumentation code providing the data.
          </p></li><li class="listitem"><p>
            The <code class="literal">WORK_COMPLETED</code> value can increase one
            or many units at a time, depending on the instrumented code.
          </p></li><li class="listitem"><p>
            The <code class="literal">WORK_ESTIMATED</code> value can change
            during the stage, depending on the instrumented code.
</p></li></ul>
</div>
<p>
        Instrumentation for a stage event progress indicator can
        implement any of the following behaviors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            No progress instrumentation
          </p><p>
            This is the most typical case, where no progress data is
            provided. The <code class="literal">WORK_COMPLETED</code> and
            <code class="literal">WORK_ESTIMATED</code> columns are both
            <code class="literal">NULL</code>.
          </p></li><li class="listitem"><p>
            Unbounded progress instrumentation
          </p><p>
            Only the <code class="literal">WORK_COMPLETED</code> column is
            meaningful. No data is provided for the
            <code class="literal">WORK_ESTIMATED</code> column, which displays 0.
          </p><p>
            By querying the
            <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a> table for
            the monitored session, a monitoring application can report
            how much work has been performed so far, but cannot report
            whether the stage is near completion. Currently, no stages
            are instrumented like this.
          </p></li><li class="listitem"><p>
            Bounded progress instrumentation
          </p><p>
            The <code class="literal">WORK_COMPLETED</code> and
            <code class="literal">WORK_ESTIMATED</code> columns are both
            meaningful.
          </p><p>
            This type of progress indicator is appropriate for an an
            operation with a defined completion criterion, such as the
            table-copy instrument described later. By querying the
            <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a> table for
            the monitored session, a monitoring application can report
            how much work has been performed so far, and can report the
            overall completion percentage for the stage, by computing
            the <code class="literal">WORK_COMPLETED</code> /
            <code class="literal">WORK_ESTIMATED</code> ratio.
</p></li></ul>
</div>
<p>
        The <code class="literal">stage/sql/copy to tmp table</code> instrument
        illustrates how progress indicators work. During execution of an
        <a class="link" href="sql-syntax.html#alter-table" title="13.1.8 ALTER TABLE Syntax"><code class="literal">ALTER TABLE</code></a> statement, the
        <code class="literal">stage/sql/copy to tmp table</code> stage is used,
        and this stage can execute potentially for a long time,
        depending on the size of the data to copy.
      </p><p>
        The table-copy task has a defined termination (all rows copied),
        and the <code class="literal">stage/sql/copy to tmp table</code> stage is
        instrumented to provided bounded progress information: The work
        unit used is number of rows copied,
        <code class="literal">WORK_COMPLETED</code> and
        <code class="literal">WORK_ESTIMATED</code> are both meaningful, and their
        ratio indicates task percentage complete.
      </p><p>
        To enable the instrument and the relevant consumers, execute
        these statements:
      </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED='YES'
WHERE NAME='stage/sql/copy to tmp table';
UPDATE setup_consumers SET ENABLED='YES'
WHERE NAME LIKE 'events_stages_%';
</pre><p>
        To see the progress of an ongoing <a class="link" href="sql-syntax.html#alter-table" title="13.1.8 ALTER TABLE Syntax"><code class="literal">ALTER
        TABLE</code></a> statement, select from the
        <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a> table.
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-stages-current-table"></a>25.11.5.1 The events_stages_current Table</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm139684629441520"></a><a class="indexterm" name="idm139684629440016"></a><p>
          The <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a> table
          contains current stage events, one row per thread showing the
          current status of the thread's most recent monitored stage
          event.
        </p><p>
          Of the tables that contain stage event rows,
          <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a> is the most
          fundamental. Other tables that contain stage event rows are
          logically derived from the current events. For example, the
          <a class="link" href="performance-schema.html#events-stages-history-table" title="25.11.5.2 The events_stages_history Table"><code class="literal">events_stages_history</code></a> and
          <a class="link" href="performance-schema.html#events-stages-history-long-table" title="25.11.5.3 The events_stages_history_long Table"><code class="literal">events_stages_history_long</code></a> tables
          are collections of the most recent stage events, up to a fixed
          number of rows.
        </p><p>
          For information about configuration of stage event collection,
          see <a class="xref" href="performance-schema.html#performance-schema-stage-tables" title="25.11.5 Performance Schema Stage Event Tables">Section 25.11.5, “Performance Schema Stage Event Tables”</a>.
        </p><p>
          The <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a> table
          has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">THREAD_ID</code>, <code class="literal">EVENT_ID</code>
            </p><p>
              The thread associated with the event and the thread
              current event number when the event starts. The
              <code class="literal">THREAD_ID</code> and
              <code class="literal">EVENT_ID</code> values taken together uniquely
              identify the row. No two rows have the same pair of
              values.
            </p></li><li class="listitem"><p>
              <code class="literal">END_EVENT_ID</code>
            </p><p>
              This column is set to <code class="literal">NULL</code> when the
              event starts and updated to the thread current event
              number when the event ends.
            </p></li><li class="listitem"><p>
              <code class="literal">EVENT_NAME</code>
            </p><p>
              The name of the instrument that produced the event. This
              is a <code class="literal">NAME</code> value from the
              <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
              Instrument names may have multiple parts and form a
              hierarchy, as discussed in
              <a class="xref" href="performance-schema.html#performance-schema-instrument-naming" title="25.6 Performance Schema Instrument Naming Conventions">Section 25.6, “Performance Schema Instrument Naming Conventions”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">SOURCE</code>
            </p><p>
              The name of the source file containing the instrumented
              code that produced the event and the line number in the
              file at which the instrumentation occurs. This enables you
              to check the source to determine exactly what code is
              involved.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_START</code>,
              <code class="literal">TIMER_END</code>,
              <code class="literal">TIMER_WAIT</code>
            </p><p>
              Timing information for the event. The unit for these
              values is picoseconds (trillionths of a second). The
              <code class="literal">TIMER_START</code> and
              <code class="literal">TIMER_END</code> values indicate when event
              timing started and ended. <code class="literal">TIMER_WAIT</code> is
              the event elapsed time (duration).
            </p><p>
              If an event has not finished, <code class="literal">TIMER_END</code>
              is the current timer value and
              <code class="literal">TIMER_WAIT</code> is the time elapsed so far
              (<code class="literal">TIMER_END</code> −
              <code class="literal">TIMER_START</code>).
            </p><p>
              If an event is produced from an instrument that has
              <code class="literal">TIMED = NO</code>, timing information is not
              collected, and <code class="literal">TIMER_START</code>,
              <code class="literal">TIMER_END</code>, and
              <code class="literal">TIMER_WAIT</code> are all
              <code class="literal">NULL</code>.
            </p><p>
              For discussion of picoseconds as the unit for event times
              and factors that affect time values, see
              <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">WORK_COMPLETED</code>,
              <code class="literal">WORK_ESTIMATED</code>
            </p><p>
              These columns provide stage progress information, for
              instruments that have been implemented to produce such
              information. <code class="literal">WORK_COMPLETED</code> indicates
              how many work units have been completed for the stage, and
              <code class="literal">WORK_ESTIMATED</code> indicates how many work
              units are expected for the stage. For more information,
              see <a class="xref" href="performance-schema.html#stage-event-progress" title="Stage Event Progress Information">Stage Event Progress Information</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">NESTING_EVENT_ID</code>
            </p><p>
              The <code class="literal">EVENT_ID</code> value of the event within
              which this event is nested. The nesting event for a stage
              event is usually a statement event.
            </p></li><li class="listitem"><p>
              <code class="literal">NESTING_EVENT_TYPE</code>
            </p><p>
              The nesting event type. The value is
              <code class="literal">TRANSACTION</code>,
              <code class="literal">STATEMENT</code>, <code class="literal">STAGE</code>, or
              <code class="literal">WAIT</code>.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a> table.
          It removes the rows.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-stages-history-table"></a>25.11.5.2 The events_stages_history Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629383696"></a><a class="indexterm" name="idm139684629382192"></a><p>
          The <a class="link" href="performance-schema.html#events-stages-history-table" title="25.11.5.2 The events_stages_history Table"><code class="literal">events_stages_history</code></a> table
          contains the most recent <em class="replaceable"><code>N</code></em> stage
          events per thread. The value of <em class="replaceable"><code>N</code></em>
          is autosized at server startup. To set the table size
          explicitly, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_stages_history_size"><code class="literal">performance_schema_events_stages_history_size</code></a>
          system variable at server startup. Stage events are not added
          to the table until they have ended. As new events are added,
          older events are discarded if the table is full.
        </p><p>
          The <a class="link" href="performance-schema.html#events-stages-history-table" title="25.11.5.2 The events_stages_history Table"><code class="literal">events_stages_history</code></a> table
          has the same structure as
          <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a>. See
          <a class="xref" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table">Section 25.11.5.1, “The events_stages_current Table”</a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-stages-history-table" title="25.11.5.2 The events_stages_history Table"><code class="literal">events_stages_history</code></a> table.
          It removes the rows.
        </p><p>
          For information about configuration of stage event collection,
          see <a class="xref" href="performance-schema.html#performance-schema-stage-tables" title="25.11.5 Performance Schema Stage Event Tables">Section 25.11.5, “Performance Schema Stage Event Tables”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-stages-history-long-table"></a>25.11.5.3 The events_stages_history_long Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629367408"></a><a class="indexterm" name="idm139684629365904"></a><p>
          The <a class="link" href="performance-schema.html#events-stages-history-long-table" title="25.11.5.3 The events_stages_history_long Table"><code class="literal">events_stages_history_long</code></a>
          table contains the most recent <em class="replaceable"><code>N</code></em>
          stage events. The value of <em class="replaceable"><code>N</code></em> is
          autosized at server startup. To set the table size explicitly,
          set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_stages_history_long_size"><code class="literal">performance_schema_events_stages_history_long_size</code></a>
          system variable at server startup. Stage events are not added
          to the table until they have ended. As new events are added,
          older events are discarded if the table is full. When a thread
          ends, its rows are removed from the table.
        </p><p>
          The <a class="link" href="performance-schema.html#events-stages-history-long-table" title="25.11.5.3 The events_stages_history_long Table"><code class="literal">events_stages_history_long</code></a>
          table has the same structure as
          <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a>. See
          <a class="xref" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table">Section 25.11.5.1, “The events_stages_current Table”</a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-stages-history-long-table" title="25.11.5.3 The events_stages_history_long Table"><code class="literal">events_stages_history_long</code></a>
          table. It removes the rows.
        </p><p>
          For information about configuration of stage event collection,
          see <a class="xref" href="performance-schema.html#performance-schema-stage-tables" title="25.11.5 Performance Schema Stage Event Tables">Section 25.11.5, “Performance Schema Stage Event Tables”</a>.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-statement-tables"></a>25.11.6 Performance Schema Statement Event Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#events-statements-current-table">25.11.6.1 The events_statements_current Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#events-statements-history-table">25.11.6.2 The events_statements_history Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#events-statements-history-long-table">25.11.6.3 The events_statements_history_long Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#prepared-statements-instances-table">25.11.6.4 The prepared_statements_instances Table</a></span></dt></dl>
</div>
<p>
        The Performance Schema instruments statement execution.
        Statement events occur at a high level of the event hierarchy.
        Within the event hierarchy, wait events nest within stage
        events, which nest within statement events, which nest within
        transaction events.
      </p><p>
        These tables store statement events:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>:
            Current statement events
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a>: The
            most recent statement events per thread
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>:
            The most recent statement events globally (across all
            threads)
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>:
            Prepared statement instances and statistics
</p></li></ul>
</div>
<p>
        The following sections describe the statement event tables.
        There are also summary tables that aggregate information about
        statement events; see
        <a class="xref" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables">Section 25.11.15.3, “Statement Summary Tables”</a>.
</p>
<h4><a name="performance-schema-statement-tables-configuration"></a>Statement Event Configuration</h4>
<p>
        To control collection of statement events, set the state of the
        relevant instruments and consumers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table
            contains instruments with names that begin with
            <code class="literal">statement</code>. Use these instruments to
            enable or disable collection of statement events.
          </p></li><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table
            contains consumer values with names corresponding to the
            current and recent statement event table names, and the
            statement digest consumer. Use these consumers to filter
            collection of statement events and statement digesting.
</p></li></ul>
</div>
<p>
        The statement instruments are enabled by default, and the
        <code class="literal">events_statements_current</code>,
        <code class="literal">events_statements_history</code>, and
        <code class="literal">statements_digest</code> statement consumers are
        enabled by default:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments WHERE NAME LIKE 'statement/%';</code></strong>
+---------------------------------------------+---------+-------+
| NAME                                        | ENABLED | TIMED |
+---------------------------------------------+---------+-------+
| statement/sql/select                        | YES     | YES   |
| statement/sql/create_table                  | YES     | YES   |
| statement/sql/create_index                  | YES     | YES   |
...
| statement/sp/stmt                           | YES     | YES   |
| statement/sp/set                            | YES     | YES   |
| statement/sp/set_trigger_field              | YES     | YES   |
| statement/scheduler/event                   | YES     | YES   |
| statement/com/Sleep                         | YES     | YES   |
| statement/com/Quit                          | YES     | YES   |
| statement/com/Init DB                       | YES     | YES   |
...
| statement/abstract/Query                    | YES     | YES   |
| statement/abstract/new_packet               | YES     | YES   |
| statement/abstract/relay_log                | YES     | YES   |
+---------------------------------------------+---------+-------+
</pre><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers WHERE NAME LIKE '%statements%';</code></strong>
+--------------------------------+---------+
| NAME                           | ENABLED |
+--------------------------------+---------+
| events_statements_current      | YES     |
| events_statements_history      | YES     |
| events_statements_history_long | NO      |
| statements_digest              | YES     |
+--------------------------------+---------+
</pre><p>
        To control statement event collection at server startup, use
        lines like these in your <code class="filename">my.cnf</code> file:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Enable:
          </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='statement/%=ON'
performance-schema-consumer-events-statements-current=ON
performance-schema-consumer-events-statements-history=ON
performance-schema-consumer-events-statements-history-long=ON
performance-schema-consumer-statements-digest=ON
</pre></li><li class="listitem"><p>
            Disable:
          </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='statement/%=OFF'
performance-schema-consumer-events-statements-current=OFF
performance-schema-consumer-events-statements-history=OFF
performance-schema-consumer-events-statements-history-long=OFF
performance-schema-consumer-statements-digest=OFF
</pre></li></ul>
</div>
<p>
        To control statement event collection at runtime, update the
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> and
        <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Enable:
          </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'YES', TIMED = 'YES'
WHERE NAME LIKE 'statement/%';
UPDATE setup_consumers SET ENABLED = 'YES'
WHERE NAME LIKE '%statements%';
</pre></li><li class="listitem"><p>
            Disable:
          </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'NO', TIMED = 'NO'
WHERE NAME LIKE 'statement/%';
UPDATE setup_consumers SET ENABLED = 'NO'
WHERE NAME LIKE '%statements%';
</pre></li></ul>
</div>
<p>
        To collect only specific statement events, enable only the
        corresponding statement instruments. To collect statement events
        only for specific statement event tables, enable the statement
        instruments but only the statement consumers corresponding to
        the desired tables.
      </p><p>
        The <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table contains a
        row with a <code class="literal">NAME</code> value of
        <code class="literal">statement</code> that indicates the unit for
        statement event timing. The default unit is
        <code class="literal">NANOSECOND</code>:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_timers WHERE NAME = 'statement';</code></strong>
+-----------+------------+
| NAME      | TIMER_NAME |
+-----------+------------+
| statement | NANOSECOND |
+-----------+------------+
</pre><p>
        To change the timing unit, modify the
        <code class="literal">TIMER_NAME</code> value:
      </p><pre data-lang="sql" class="programlisting">
UPDATE setup_timers SET TIMER_NAME = 'MICROSECOND'
WHERE NAME = 'statement';
</pre><p>
        For additional information about configuring event collection,
        see <a class="xref" href="performance-schema.html#performance-schema-startup-configuration" title="25.3 Performance Schema Startup Configuration">Section 25.3, “Performance Schema Startup Configuration”</a>,
        and <a class="xref" href="performance-schema.html#performance-schema-runtime-configuration" title="25.4 Performance Schema Runtime Configuration">Section 25.4, “Performance Schema Runtime Configuration”</a>.
</p>
<h4><a name="performance-schema-statement-tables-monitoring"></a>Statement Monitoring</h4>
<p>
        Statement monitoring begins from the moment the server sees that
        activity is requested on a thread, to the moment when all
        activity has ceased. Typically, this means from the time the
        server gets the first packet from the client to the time the
        server has finished sending the response. Statements within
        stored programs are monitored like other statements.
      </p><p>
        When the Performance Schema instruments a request (server
        command or SQL statement), it uses instrument names that proceed
        in stages from more general (or <span class="quote">“<span class="quote">abstract</span>”</span>) to more
        specific until it arrives at a final instrument name.
      </p><p>
        Final instrument names correspond to server commands and SQL
        statements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Server commands correspond to the
            <code class="literal">COM_<em class="replaceable"><code>xxx</code></em> codes</code>
            defined in the <code class="filename">mysql_com.h</code> header file
            and processed in <code class="filename">sql/sql_parse.cc</code>.
            Examples are <code class="literal">COM_PING</code> and
            <code class="literal">COM_QUIT</code>. Instruments for commands have
            names that begin with <code class="literal">statement/com</code>, such
            as <code class="literal">statement/com/Ping</code> and
            <code class="literal">statement/com/Quit</code>.
          </p></li><li class="listitem"><p>
            SQL statements are expressed as text, such as
            <code class="literal">DELETE FROM t1</code> or <code class="literal">SELECT * FROM
            t2</code>. Instruments for SQL statements have names that
            begin with <code class="literal">statement/sql</code>, such as
            <code class="literal">statement/sql/delete</code> and
            <code class="literal">statement/sql/select</code>.
</p></li></ul>
</div>
<p>
        Some final instrument names are specific to error handling:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">statement/com/Error</code> accounts for messages
            received by the server that are out of band. It can be used
            to detect commands sent by clients that the server does not
            understand. This may be helpful for purposes such as
            identifying clients that are misconfigured or using a
            version of MySQL more recent than that of the server, or
            clients that are attempting to attack the server.
          </p></li><li class="listitem"><p>
            <code class="literal">statement/sql/error</code> accounts for SQL
            statements that fail to parse. It can be used to detect
            malformed queries sent by clients. A query that fails to
            parse differs from a query that parses but fails due to an
            error during execution. For example, <code class="literal">SELECT *
            FROM</code> is malformed, and the
            <code class="literal">statement/sql/error</code> instrument is used.
            By contrast, <code class="literal">SELECT *</code> parses but fails
            with a <code class="literal">No tables used</code> error. In this
            case, <code class="literal">statement/sql/select</code> is used and
            the statement event contains information to indicate the
            nature of the error.
</p></li></ul>
</div>
<p>
        A request can be obtained from any of these sources:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            As a command or statement request from a client, which sends
            the request as packets
          </p></li><li class="listitem"><p>
            As a statement string read from the relay log on a
            replication slave
          </p></li><li class="listitem"><p>
            As an event from the Event Scheduler
</p></li></ul>
</div>
<p>
        The details for a request are not initially known and the
        Performance Schema proceeds from abstract to specific instrument
        names in a sequence that depends on the source of the request.
      </p><p>
        For a request received from a client:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1"><li class="listitem"><p>
            When the server detects a new packet at the socket level, a
            new statement is started with an abstract instrument name of
            <code class="literal">statement/abstract/new_packet</code>.
          </p></li><li class="listitem"><p>
            When the server reads the packet number, it knows more about
            the type of request received, and the Performance Schema
            refines the instrument name. For example, if the request is
            a <code class="literal">COM_PING</code> packet, the instrument name
            becomes <code class="literal">statement/com/Ping</code> and that is
            the final name. If the request is a
            <code class="literal">COM_QUERY</code> packet, it is known to
            correspond to an SQL statement but not the particular type
            of statement. In this case, the instrument changes from one
            abstract name to a more specific but still abstract name,
            <code class="literal">statement/abstract/Query</code>, and the request
            requires further classification.
          </p></li><li class="listitem"><p>
            If the request is a statement, the statement text is read
            and given to the parser. After parsing, the exact statement
            type is known. If the request is, for example, an
            <a class="link" href="sql-syntax.html#insert" title="13.2.5 INSERT Syntax"><code class="literal">INSERT</code></a> statement, the
            Performance Schema refines the instrument name from
            <code class="literal">statement/abstract/Query</code> to
            <code class="literal">statement/sql/insert</code>, which is the final
            name.
</p></li></ol>
</div>
<p>
        For a request read as a statement from the relay log on a
        replication slave:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1"><li class="listitem"><p>
            Statements in the relay log are stored as text and are read
            as such. There is no network protocol, so the
            <code class="literal">statement/abstract/new_packet</code> instrument
            is not used. Instead, the initial instrument is
            <code class="literal">statement/abstract/relay_log</code>.
          </p></li><li class="listitem"><p>
            When the statement is parsed, the exact statement type is
            known. If the request is, for example, an
            <a class="link" href="sql-syntax.html#insert" title="13.2.5 INSERT Syntax"><code class="literal">INSERT</code></a> statement, the
            Performance Schema refines the instrument name from
            <code class="literal">statement/abstract/Query</code> to
            <code class="literal">statement/sql/insert</code>, which is the final
            name.
</p></li></ol>
</div>
<p>
        The preceding description applies only for statement-based
        replication. For row-based replication, table I/O done on the
        slave as it processes row changes can be instrumented, but row
        events in the relay log do not appear as discrete statements.
      </p><p>
        For a request received from the Event Scheduler:
      </p><p>
        The event execution is instrumented using the name
        <code class="literal">statement/scheduler/event</code>. This is the final
        name.
      </p><p>
        Statements executed within the event body are instrumented using
        <code class="literal">statement/sql/*</code> names, without use of any
        preceding abstract instrument. An event is a stored program, and
        stored programs are precompiled in memory before execution.
        Consequently, there is no parsing at runtime and the type of
        each statement is known by the time it executes.
      </p><p>
        Statements executed within the event body are child statements.
        For example, if an event executes an
        <a class="link" href="sql-syntax.html#insert" title="13.2.5 INSERT Syntax"><code class="literal">INSERT</code></a> statement, execution of
        the event itself is the parent, instrumented using
        <code class="literal">statement/scheduler/event</code>, and the
        <a class="link" href="sql-syntax.html#insert" title="13.2.5 INSERT Syntax"><code class="literal">INSERT</code></a> is the child, instrumented
        using <code class="literal">statement/sql/insert</code>. The parent/child
        relationship holds <span class="emphasis"><em>between</em></span> separate
        instrumented operations. This differs from the sequence of
        refinement that occurs <span class="emphasis"><em>within</em></span> a single
        instrumented operation, from abstract to final instrument names.
      </p><p>
        For statistics to be collected for statements, it is not
        sufficient to enable only the final
        <code class="literal">statement/sql/*</code> instruments used for
        individual statement types. The abtract
        <code class="literal">statement/abstract/*</code> instruments must be
        enabled as well. This should not normally be an issue because
        all statement instruments are enabled by default. However, an
        application that enables or disables statement instruments
        selectively must take into account that disabling abstract
        instruments also disables statistics collection for the
        individual statement instruments. For example, to collect
        statistics for <a class="link" href="sql-syntax.html#insert" title="13.2.5 INSERT Syntax"><code class="literal">INSERT</code></a> statements,
        <code class="literal">statement/sql/insert</code> must be enabled, but
        also <code class="literal">statement/abstract/new_packet</code> and
        <code class="literal">statement/abstract/Query</code>. Similarly, for
        replicated statements to be instrumented,
        <code class="literal">statement/abstract/relay_log</code> must be enabled.
      </p><p>
        No statistics are aggregated for abstract instruments such as
        <code class="literal">statement/abstract/Query</code> because no statement
        is ever classified with an abstract instrument as the final
        statement name.
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-statements-current-table"></a>25.11.6.1 The events_statements_current Table</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm139684629235776"></a><a class="indexterm" name="idm139684629234272"></a><p>
          The <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>
          table contains current statement events, one row per thread
          showing the current status of the thread's most recent
          monitored statement event.
        </p><p>
          Of the tables that contain statement event rows,
          <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a> is the
          most fundamental. Other tables that contain statement event
          rows are logically derived from the current events. For
          example, the
          <a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a> and
          <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>
          tables are collections of the most recent statement events, up
          to a fixed number of rows.
        </p><p>
          For information about configuration of statement event
          collection, see
          <a class="xref" href="performance-schema.html#performance-schema-statement-tables" title="25.11.6 Performance Schema Statement Event Tables">Section 25.11.6, “Performance Schema Statement Event Tables”</a>.
        </p><p>
          The <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>
          table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">THREAD_ID</code>, <code class="literal">EVENT_ID</code>
            </p><p>
              The thread associated with the event and the thread
              current event number when the event starts. The
              <code class="literal">THREAD_ID</code> and
              <code class="literal">EVENT_ID</code> values taken together uniquely
              identify the row. No two rows have the same pair of
              values.
            </p></li><li class="listitem"><p>
              <code class="literal">END_EVENT_ID</code>
            </p><p>
              This column is set to <code class="literal">NULL</code> when the
              event starts and updated to the thread current event
              number when the event ends.
            </p></li><li class="listitem"><p>
              <code class="literal">EVENT_NAME</code>
            </p><p>
              The name of the instrument from which the event was
              collected. This is a <code class="literal">NAME</code> value from
              the <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
              Instrument names may have multiple parts and form a
              hierarchy, as discussed in
              <a class="xref" href="performance-schema.html#performance-schema-instrument-naming" title="25.6 Performance Schema Instrument Naming Conventions">Section 25.6, “Performance Schema Instrument Naming Conventions”</a>.
            </p><p>
              For SQL statements, the <code class="literal">EVENT_NAME</code>
              value initially is <code class="literal">statement/com/Query</code>
              until the statement is parsed, then changes to a more
              appropriate value, as described in
              <a class="xref" href="performance-schema.html#performance-schema-statement-tables" title="25.11.6 Performance Schema Statement Event Tables">Section 25.11.6, “Performance Schema Statement Event Tables”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">SOURCE</code>
            </p><p>
              The name of the source file containing the instrumented
              code that produced the event and the line number in the
              file at which the instrumentation occurs. This enables you
              to check the source to determine exactly what code is
              involved.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_START</code>,
              <code class="literal">TIMER_END</code>,
              <code class="literal">TIMER_WAIT</code>
            </p><p>
              Timing information for the event. The unit for these
              values is picoseconds (trillionths of a second). The
              <code class="literal">TIMER_START</code> and
              <code class="literal">TIMER_END</code> values indicate when event
              timing started and ended. <code class="literal">TIMER_WAIT</code> is
              the event elapsed time (duration).
            </p><p>
              If an event has not finished, <code class="literal">TIMER_END</code>
              is the current timer value and
              <code class="literal">TIMER_WAIT</code> is the time elapsed so far
              (<code class="literal">TIMER_END</code> −
              <code class="literal">TIMER_START</code>).
            </p><p>
              If an event is produced from an instrument that has
              <code class="literal">TIMED = NO</code>, timing information is not
              collected, and <code class="literal">TIMER_START</code>,
              <code class="literal">TIMER_END</code>, and
              <code class="literal">TIMER_WAIT</code> are all
              <code class="literal">NULL</code>.
            </p><p>
              For discussion of picoseconds as the unit for event times
              and factors that affect time values, see
              <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">LOCK_TIME</code>
            </p><p>
              The time spent waiting for table locks. This value is
              computed in microseconds but normalized to picoseconds for
              easier comparison with other Performance Schema timers.
            </p></li><li class="listitem"><p>
              <code class="literal">SQL_TEXT</code>
            </p><p>
              The text of the SQL statement. For a command not
              associated with an SQL statement, the value is
              <code class="literal">NULL</code>.
            </p><p>
              The maximum space available for statement display is 1024
              bytes by default. To change this value, set the
              <a class="link" href="performance-schema.html#sysvar_performance_schema_max_sql_text_length"><code class="literal">performance_schema_max_sql_text_length</code></a>
              system variable at server startup.
            </p></li><li class="listitem"><p>
              <code class="literal">DIGEST</code>
            </p><p>
              The statement digest MD5 value as a string of 32
              hexadecimal characters, or <code class="literal">NULL</code> if the
              <code class="literal">statements_digest</code> consumer is
              <code class="literal">no</code>. For more information about
              statement digesting, see
              <a class="xref" href="performance-schema.html#performance-schema-statement-digests" title="25.9 Performance Schema Statement Digests">Section 25.9, “Performance Schema Statement Digests”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">DIGEST_TEXT</code>
            </p><p>
              The normalized statement digest text, or
              <code class="literal">NULL</code> if the
              <code class="literal">statements_digest</code> consumer is
              <code class="literal">no</code>. For more information about
              statement digesting, see
              <a class="xref" href="performance-schema.html#performance-schema-statement-digests" title="25.9 Performance Schema Statement Digests">Section 25.9, “Performance Schema Statement Digests”</a>.
            </p><p>
              The
              <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
              system variable determines the maximum number of bytes
              available for digest value storage. However, the display
              length of statement digests may be longer than the
              available buffer size due to encoding of statement
              components such as keywords and literal values in digest
              buffer. Consequently, values selected from the
              <code class="literal">DIGEST_TEXT</code> column of statement event
              tables may appear to exceed the
              <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
              value.
            </p></li><li class="listitem"><p>
              <code class="literal">CURRENT_SCHEMA</code>
            </p><p>
              The default database for the statement,
              <code class="literal">NULL</code> if there is none.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_SCHEMA</code>,
              <code class="literal">OBJECT_NAME</code>,
              <code class="literal">OBJECT_TYPE</code>
            </p><p>
              For nested statements (stored programs), these columns
              contain information about the parent statement. Otherwise
              they are <code class="literal">NULL</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              This column identifies the statement. The value is the
              address of an object in memory.
            </p></li><li class="listitem"><p>
              <code class="literal">MYSQL_ERRNO</code>
            </p><p>
              The statement error number, from the statement diagnostics
              area.
            </p></li><li class="listitem"><p>
              <code class="literal">RETURNED_SQLSTATE</code>
            </p><p>
              The statement SQLSTATE value, from the statement
              diagnostics area.
            </p></li><li class="listitem"><p>
              <code class="literal">MESSAGE_TEXT</code>
            </p><p>
              The statement error message, from the statement
              diagnostics area.
            </p></li><li class="listitem"><p>
              <code class="literal">ERRORS</code>
            </p><p>
              Whether an error occurred for the statement. The value is
              0 if the SQLSTATE value begins with <code class="literal">00</code>
              (completion) or <code class="literal">01</code> (warning). The value
              is 1 is the SQLSTATE value is anything else.
            </p></li><li class="listitem"><p>
              <code class="literal">WARNINGS</code>
            </p><p>
              The number of warnings, from the statement diagnostics
              area.
            </p></li><li class="listitem"><p>
              <code class="literal">ROWS_AFFECTED</code>
            </p><p>
              The number of rows affected by the statement. For a
              description of the meaning of <span class="quote">“<span class="quote">affected,</span>”</span> see
              <a class="xref" href="connectors-apis.html#mysql-affected-rows" title="27.8.7.1 mysql_affected_rows()">Section 27.8.7.1, “mysql_affected_rows()”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">ROWS_SENT</code>
            </p><p>
              The number of rows returned by the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">ROWS_EXAMINED</code>
            </p><p>
              The number of rows read from storage engines during
              statement execution.
            </p></li><li class="listitem"><p>
              <code class="literal">CREATED_TMP_DISK_TABLES</code>
            </p><p>
              Like the
              <a class="link" href="server-administration.html#statvar_Created_tmp_disk_tables"><code class="literal">Created_tmp_disk_tables</code></a>
              status variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">CREATED_TMP_TABLES</code>
            </p><p>
              Like the
              <a class="link" href="server-administration.html#statvar_Created_tmp_tables"><code class="literal">Created_tmp_tables</code></a>
              status variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SELECT_FULL_JOIN</code>
            </p><p>
              Like the
              <a class="link" href="server-administration.html#statvar_Select_full_join"><code class="literal">Select_full_join</code></a> status
              variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SELECT_FULL_RANGE_JOIN</code>
            </p><p>
              Like the
              <a class="link" href="server-administration.html#statvar_Select_full_range_join"><code class="literal">Select_full_range_join</code></a>
              status variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SELECT_RANGE</code>
            </p><p>
              Like the <a class="link" href="server-administration.html#statvar_Select_range"><code class="literal">Select_range</code></a>
              status variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SELECT_RANGE_CHECK</code>
            </p><p>
              Like the
              <a class="link" href="server-administration.html#statvar_Select_range_check"><code class="literal">Select_range_check</code></a>
              status variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SELECT_SCAN</code>
            </p><p>
              Like the <a class="link" href="server-administration.html#statvar_Select_scan"><code class="literal">Select_scan</code></a>
              status variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SORT_MERGE_PASSES</code>
            </p><p>
              Like the
              <a class="link" href="server-administration.html#statvar_Sort_merge_passes"><code class="literal">Sort_merge_passes</code></a> status
              variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SORT_RANGE</code>
            </p><p>
              Like the <a class="link" href="server-administration.html#statvar_Sort_range"><code class="literal">Sort_range</code></a>
              status variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SORT_ROWS</code>
            </p><p>
              Like the <a class="link" href="server-administration.html#statvar_Sort_rows"><code class="literal">Sort_rows</code></a>
              status variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SORT_SCAN</code>
            </p><p>
              Like the <a class="link" href="server-administration.html#statvar_Sort_scan"><code class="literal">Sort_scan</code></a>
              status variable, but specific to the statement.
            </p></li><li class="listitem"><p>
              <code class="literal">NO_INDEX_USED</code>
            </p><p>
              1 if the statement performed a table scan without using an
              index, 0 otherwise.
            </p></li><li class="listitem"><p>
              <code class="literal">NO_GOOD_INDEX_USED</code>
            </p><p>
              1 if the server found no good index to use for the
              statement, 0 otherwise. For additional information, see
              the description of the <code class="literal">Extra</code> column
              from <code class="literal">EXPLAIN</code> output for the
              <code class="literal">Range checked for each record</code> value in
              <a class="xref" href="optimization.html#explain-output" title="8.8.2 EXPLAIN Output Format">Section 8.8.2, “EXPLAIN Output Format”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">NESTING_EVENT_ID</code>,
              <code class="literal">NESTING_EVENT_TYPE</code>,
              <code class="literal">NESTING_EVENT_LEVEL</code>
            </p><p>
              These three columns are used with other columns to provide
              information as follows for top-level (unnested) statements
              and nested statements (executed within a stored program).
            </p><p>
              For top level statements:
            </p><pre data-lang="none" class="programlisting">
OBJECT_TYPE = NULL
OBJECT_SCHEMA = NULL
OBJECT_NAME = NULL
NESTING_EVENT_ID = NULL
NESTING_EVENT_TYPE = NULL
NESTING_LEVEL = 0
</pre><p>
              For nested statements:
            </p><pre data-lang="none" class="programlisting">
OBJECT_TYPE = the parent statement object type
OBJECT_SCHEMA = the parent statement object schema
OBJECT_NAME = the parent statement object name
NESTING_EVENT_ID = the parent statement EVENT_ID
NESTING_EVENT_TYPE = 'STATEMENT'
NESTING_LEVEL = the parent statement NESTING_LEVEL plus one
</pre></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>
          table. It removes the rows.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-statements-history-table"></a>25.11.6.2 The events_statements_history Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629091104"></a><a class="indexterm" name="idm139684629089600"></a><p>
          The <a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a>
          table contains the most recent <em class="replaceable"><code>N</code></em>
          statement events per thread. The value of
          <em class="replaceable"><code>N</code></em> is autosized at server startup.
          To set the table size explicitly, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_statements_history_size"><code class="literal">performance_schema_events_statements_history_size</code></a>
          system variable at server startup. Statement events are not
          added to the table until they have ended. As new events are
          added, older events are discarded if the table is full.
        </p><p>
          The <a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a>
          table has the same structure as
          <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>. See
          <a class="xref" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table">Section 25.11.6.1, “The events_statements_current Table”</a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a>
          table. It removes the rows.
        </p><p>
          For information about configuration of statement event
          collection, see
          <a class="xref" href="performance-schema.html#performance-schema-statement-tables" title="25.11.6 Performance Schema Statement Event Tables">Section 25.11.6, “Performance Schema Statement Event Tables”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-statements-history-long-table"></a>25.11.6.3 The events_statements_history_long Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684629074576"></a><a class="indexterm" name="idm139684629073120"></a><p>
          The
          <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>
          table contains the most recent <em class="replaceable"><code>N</code></em>
          statement events. The value of <em class="replaceable"><code>N</code></em> is
          autosized at server startup. To set the table size explicitly,
          set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_statements_history_long_size"><code class="literal">performance_schema_events_statements_history_long_size</code></a>
          system variable at server startup. Statement events are not
          added to the table until they have ended. As new events are
          added, older events are discarded if the table is full. When a
          thread ends, its rows are removed from the table.
        </p><p>
          The
          <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>
          table has the same structure as
          <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>. See
          <a class="xref" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table">Section 25.11.6.1, “The events_statements_current Table”</a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the
          <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>
          table. It removes the rows.
        </p><p>
          For information about configuration of statement event
          collection, see
          <a class="xref" href="performance-schema.html#performance-schema-statement-tables" title="25.11.6 Performance Schema Statement Event Tables">Section 25.11.6, “Performance Schema Statement Event Tables”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="prepared-statements-instances-table"></a>25.11.6.4 The prepared_statements_instances Table</h4>

</div>

</div>

</div>
<p>
          The Performance Schema provides instrumentation for prepared
          statements, for which there are two protocols:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              The binary protocol. This is accessed through the MySQL C
              API and maps onto underlying server commands as shown in
              the following table.
</p>
<div class="informaltable">
<table summary="How the binary protocol accessed through the MySQL C API maps onto underlying server commands."><col width="50%"><col width="50%"><thead><tr>
                  <th scope="col">C API Function</th>
                  <th scope="col">Corresponding Server Command</th>
                </tr></thead><tbody><tr>
                  <td scope="row"><a class="link" href="connectors-apis.html#mysql-stmt-prepare" title="27.8.11.21 mysql_stmt_prepare()"><code class="literal">mysql_stmt_prepare()</code></a></td>
                  <td><code class="literal">COM_STMT_PREPARE</code></td>
                </tr><tr>
                  <td scope="row"><a class="link" href="connectors-apis.html#mysql-stmt-execute" title="27.8.11.10 mysql_stmt_execute()"><code class="literal">mysql_stmt_execute()</code></a></td>
                  <td><code class="literal">COM_STMT_EXECUTE</code></td>
                </tr><tr>
                  <td scope="row"><a class="link" href="connectors-apis.html#mysql-stmt-close" title="27.8.11.6 mysql_stmt_close()"><code class="literal">mysql_stmt_close()</code></a></td>
                  <td><code class="literal">COM_STMT_CLOSE</code></td>
</tr></tbody></table>
</div>
</li><li class="listitem"><p>
              The text protocol. This is accessed using SQL statements
              and maps onto underlying server commands as shown in the
              following table.
</p>
<div class="informaltable">
<table summary="How the text protocol accessed using SQL statements maps onto underlying server commands."><col width="50%"><col width="50%"><thead><tr>
                  <th scope="col">SQL Statement</th>
                  <th scope="col">Corresponding Server Command</th>
                </tr></thead><tbody><tr>
                  <td scope="row"><a class="link" href="sql-syntax.html#prepare" title="13.5.1 PREPARE Syntax"><code class="literal">PREPARE</code></a></td>
                  <td><code class="literal">SQLCOM_PREPARE</code></td>
                </tr><tr>
                  <td scope="row"><a class="link" href="sql-syntax.html#execute" title="13.5.2 EXECUTE Syntax"><code class="literal">EXECUTE</code></a></td>
                  <td><code class="literal">SQLCOM_EXECUTE</code></td>
                </tr><tr>
                  <td scope="row"><a class="link" href="sql-syntax.html#deallocate-prepare" title="13.5.3 DEALLOCATE PREPARE Syntax"><code class="literal">DEALLOCATE PREPARE</code></a>,
                    <a class="link" href="sql-syntax.html#deallocate-prepare" title="13.5.3 DEALLOCATE PREPARE Syntax"><code class="literal">DROP
                    PREPARE</code></a></td>
                  <td><code class="literal">SQLCOM_DEALLOCATE PREPARE</code></td>
</tr></tbody></table>
</div>
</li></ul>
</div>
<p>
          Performance Schema prepared statement instrumentation covers
          both protocols. The following discussion refers to the server
          commands rather than the C API functions or SQL statements.
        </p><p>
          Information about prepared statements is available in the
          <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
          table. This table enables inspection of prepared statements
          used in the server and provides aggregated statistics about
          them. To control the size of this table, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_prepared_statements_instances"><code class="literal">performance_schema_max_prepared_statements_instances</code></a>
          system variable at server startup.
        </p><p>
          Collection of prepared statement information depends on the
          statement instruments shown in the following table. These
          instruments are enabled by default. To modify them, update the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
</p>
<div class="informaltable">
<table summary="Collection of prepared statement information depends on the statement instruments shown in this table."><col width="50%"><col width="50%"><thead><tr>
              <th scope="col">Instrument</th>
              <th scope="col">Server Command</th>
            </tr></thead><tbody><tr>
              <td scope="row"><code class="literal">statement/com/Prepare</code></td>
              <td><code class="literal">COM_STMT_PREPARE</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">statement/com/Execute</code></td>
              <td><code class="literal">COM_STMT_EXECUTE</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">statement/sql/prepare_sql</code></td>
              <td><code class="literal">SQLCOM_PREPARE</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">statement/sql/execute_sql</code></td>
              <td><code class="literal">SQLCOM_EXECUTE</code></td>
</tr></tbody></table>
</div>
<p>
          The Performance Schema manages the contents of the
          <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
          table as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Statement preparation
            </p><p>
              A <code class="literal">COM_STMT_PREPARE</code> or
              <code class="literal">SQLCOM_PREPARE</code> command creates a
              prepared statement in the server. If the statement is
              successfully instrumented, a new row is added to the
              <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
              table. If the statement cannot be instrumented,
              <a class="link" href="performance-schema.html#statvar_Performance_schema_prepared_statements_lost"><code class="literal">Performance_schema_prepared_statements_lost</code></a>
              status variable is incremented.
            </p></li><li class="listitem"><p>
              Prepared statement execution
            </p><p>
              Execution of a <code class="literal">COM_STMT_EXECUTE</code> or
              <code class="literal">SQLCOM_PREPARE</code> command for an
              instrumented prepared statement instance updates the
              corresponding
              <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
              table row.
            </p></li><li class="listitem"><p>
              Prepared statement deallocation
            </p><p>
              Execution of a <code class="literal">COM_STMT_CLOSE</code> or
              <code class="literal">SQLCOM_DEALLOCATE_PREPARE</code> command for
              an instrumented prepared statement instance removes the
              corresponding
              <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
              table row. To avoid resource leaks, removal occurs even if
              the prepared statement instruments described previously
              are disabled.
</p></li></ul>
</div>
<p>
          The <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
          table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              The address in memory of the instrumented prepared
              statement.
            </p></li><li class="listitem"><p>
              <code class="literal">STATEMENT_ID</code>
            </p><p>
              The internal statement ID assigned by the server. The text
              and binary protocols both use statement IDs.
            </p></li><li class="listitem"><p>
              <code class="literal">STATEMENT_NAME</code>
            </p><p>
              For the binary protocol, this column is
              <code class="literal">NULL</code>. For the text protocol, this
              column is the external statement name assigned by the
              user. For example, for the following SQL statement, the
              name of the prepared statement is <code class="literal">stmt</code>:
            </p><pre data-lang="sql" class="programlisting">
PREPARE stmt FROM 'SELECT 1';
</pre></li><li class="listitem"><p>
              <code class="literal">SQL_TEXT</code>
            </p><p>
              The prepared statement text, with <code class="literal">?</code>
              placeholder markers.
            </p></li><li class="listitem"><p>
              <code class="literal">OWNER_THREAD_ID</code>,
              <code class="literal">OWNER_EVENT_ID</code>
            </p><p>
              These columns indicate the event that created the prepared
              statement.
            </p></li><li class="listitem"><p>
              <code class="literal">OWNER_OBJECT_TYPE</code>,
              <code class="literal">OWNER_OBJECT_SCHEMA</code>,
              <code class="literal">OWNER_OBJECT_NAME</code>
            </p><p>
              For a prepared statement created by a client session,
              these columns are <code class="literal">NULL</code>. For a prepared
              statement created by a stored program, these columns point
              to the stored program. A typical user error is forgetting
              to deallocate prepared statements. These columns can be
              used to find stored programs that leak prepared
              statements:
            </p><pre data-lang="sql" class="programlisting">
SELECT OWNER_OBJECT_TYPE, OWNER_OBJECT_SCHEMA, OWNER_OBJECT_NAME,
STATEMENT_NAME, SQL_TEXT
FROM performance_schema.prepared_statements_instances
WHERE OWNER_OBJECT_TYPE IS NOT NULL;
</pre></li><li class="listitem"><p>
              <code class="literal">TIMER_PREPARE</code>
            </p><p>
              The time spent executing the statement preparation itself.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_REPREPARE</code>
            </p><p>
              The number of times the statement was reprepared
              internally (see <a class="xref" href="optimization.html#statement-caching" title="8.10.4 Caching of Prepared Statements and Stored Programs">Section 8.10.4, “Caching of Prepared Statements and Stored Programs”</a>).
              Timing statistics for repreparation are not available
              because it is counted as part of statement execution, not
              as a separate operation.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_EXECUTE</code>,
              <code class="literal">SUM_TIMER_EXECUTE</code>,
              <code class="literal">MIN_TIMER_EXECUTE</code>,
              <code class="literal">AVG_TIMER_EXECUTE</code>,
              <code class="literal">MAX_TIMER_EXECUTE</code>
            </p><p>
              Aggregated statistics for executions of the prepared
              statement.
            </p></li><li class="listitem"><p>
              <code class="literal">SUM_<em class="replaceable"><code>xxx</code></em></code>
            </p><p>
              The remaining
              <code class="literal">SUM_<em class="replaceable"><code>xxx</code></em></code>
              columns are the same as for the statement summary tables
              (see <a class="xref" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables">Section 25.11.15.3, “Statement Summary Tables”</a>).
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> resets the
          statistics columns of the
          <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
          table.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-transaction-tables"></a>25.11.7 Performance Schema Transaction Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#events-transactions-current-table">25.11.7.1 The events_transactions_current Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#events-transactions-history-table">25.11.7.2 The events_transactions_history Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#events-transactions-history-long-table">25.11.7.3 The events_transactions_history_long Table</a></span></dt></dl>
</div>
<p>
        The Performance Schema instruments transactions. Within the
        event hierarchy, wait events nest within stage events, which
        nest within statement events, which nest within transaction
        events.
      </p><p>
        These tables store transaction events:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>:
            Current transaction events
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-transactions-history-table" title="25.11.7.2 The events_transactions_history Table"><code class="literal">events_transactions_history</code></a>:
            The most recent transaction events per thread
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#events-transactions-history-long-table" title="25.11.7.3 The events_transactions_history_long Table"><code class="literal">events_transactions_history_long</code></a>:
            The most recent transaction events globally (across all
            threads)
</p></li></ul>
</div>
<p>
        The following sections describe the transaction event tables.
        There are also summary tables that aggregate information about
        transaction events; see
        <a class="xref" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables">Section 25.11.15.4, “Transaction Summary Tables”</a>.
</p>
<h4><a name="performance-schema-transaction-tables-configuration"></a>Transaction Event Configuration</h4>
<p>
        To control collection of transaction events, set the state of
        the relevant instruments and consumers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table
            contains an instrument named <code class="literal">transaction</code>.
            Use this instrument to enable or disable collection of
            transaction events.
          </p></li><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table
            contains consumer values with names corresponding to the
            current and recent transaction event table names. Use these
            consumers to filter collection of transaction events.
</p></li></ul>
</div>
<p>
        The <code class="literal">transaction</code> instrument and the
        transaction consumers are disabled by default:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments WHERE NAME = 'transaction';</code></strong>
+-------------+---------+-------+
| NAME        | ENABLED | TIMED |
+-------------+---------+-------+
| transaction | NO      | NO    |
+-------------+---------+-------+
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_consumers WHERE NAME LIKE '%transactions%';</code></strong>
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| events_transactions_current      | NO      |
| events_transactions_history      | NO      |
| events_transactions_history_long | NO      |
+----------------------------------+---------+
</pre><p>
        To control transaction event collection at server startup, use
        lines like these in your <code class="filename">my.cnf</code> file:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Enable:
          </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='transaction=ON'
performance-schema-consumer-events-transactions-current=ON
performance-schema-consumer-events-transactions-history=ON
performance-schema-consumer-events-transactions-history-long=ON
</pre></li><li class="listitem"><p>
            Disable:
          </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='transaction=OFF'
performance-schema-consumer-events-transactions-current=OFF
performance-schema-consumer-events-transactions-history=OFF
performance-schema-consumer-events-transactions-history-long=OFF
</pre></li></ul>
</div>
<p>
        To control transaction event collection at runtime, update the
        <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> and
        <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Enable:
          </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'YES', TIMED = 'YES'
WHERE NAME = 'transaction';
UPDATE setup_consumers SET ENABLED = 'YES'
WHERE NAME LIKE '%transactions%';
</pre></li><li class="listitem"><p>
            Disable:
          </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'NO', TIMED = 'NO'
WHERE NAME = 'transaction';
UPDATE setup_consumers SET ENABLED = 'NO'
WHERE NAME LIKE '%transactions%';
</pre></li></ul>
</div>
<p>
        To collect transaction events only for specific transaction
        event tables, enable the <code class="literal">transaction</code>
        instrument but only the transaction consumers corresponding to
        the desired tables.
      </p><p>
        The <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table contains a
        row with a <code class="literal">NAME</code> value of
        <code class="literal">transaction</code> that indicates the unit for
        transaction event timing. The default unit is
        <code class="literal">NANOSECOND</code>:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_timers WHERE NAME = 'transaction';</code></strong>
+-------------+------------+
| NAME        | TIMER_NAME |
+-------------+------------+
| transaction | NANOSECOND |
+-------------+------------+
</pre><p>
        To change the timing unit, modify the
        <code class="literal">TIMER_NAME</code> value:
      </p><pre data-lang="sql" class="programlisting">
UPDATE setup_timers SET TIMER_NAME = 'MICROSECOND'
WHERE NAME = 'transaction';
</pre><p>
        For additional information about configuring event collection,
        see <a class="xref" href="performance-schema.html#performance-schema-startup-configuration" title="25.3 Performance Schema Startup Configuration">Section 25.3, “Performance Schema Startup Configuration”</a>,
        and <a class="xref" href="performance-schema.html#performance-schema-runtime-configuration" title="25.4 Performance Schema Runtime Configuration">Section 25.4, “Performance Schema Runtime Configuration”</a>.
</p>
<h4><a name="performance-schema-transaction-tables-transaction-boundaries"></a>Transaction Boundaries</h4>
<p>
        In MySQL Server, transactions start explicitly with these
        statements:
      </p><pre data-lang="sql" class="programlisting">
START TRANSACTION | BEGIN | XA START | XA BEGIN
</pre><p>
        Transactions also start implicitly. For example, when the
        <a class="link" href="server-administration.html#sysvar_autocommit"><code class="literal">autocommit</code></a> system variable is
        enabled, the start of each statement starts a new transaction.
      </p><p>
        When <a class="link" href="server-administration.html#sysvar_autocommit"><code class="literal">autocommit</code></a> is disabled,
        the first statement following a committed transaction marks the
        start of a new transaction. Subsequent statements are part of
        the transaction until it is committed.
      </p><p>
        Transactions explicitly end with these statements:
      </p><pre data-lang="sql" class="programlisting">
COMMIT | ROLLBACK | XA COMMIT | XA ROLLBACK
</pre><p>
        Transactions also end implicitly, by execution of DDL
        statements, locking statements, and server administration
        statements.
      </p><p>
        In the following discussion, references to
        <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">START
        TRANSACTION</code></a> also apply to
        <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">BEGIN</code></a>,
        <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
        START</code></a>, and
        <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
        BEGIN</code></a>. Similarly, references to
        <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">COMMIT</code></a> and
        <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">ROLLBACK</code></a> apply
        to <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
        COMMIT</code></a> and
        <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
        ROLLBACK</code></a>, respectively.
      </p><p>
        The Performance Schema defines transaction boundaries similarly
        to that of the server. The start and end of a transaction event
        closely match the corresponding state transitions in the server:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            For an explicitly started transaction, the transaction event
            starts during processing of the
            <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">START
            TRANSACTION</code></a> statement.
          </p></li><li class="listitem"><p>
            For an implicitly started transaction, the transaction event
            starts on the first statement that uses a transactional
            engine after the previous transaction has ended.
          </p></li><li class="listitem"><p>
            For any transaction, whether explicitly or implicitly ended,
            the transaction event ends when the server transitions out
            of the active transaction state during the processing of
            <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">COMMIT</code></a> or
            <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">ROLLBACK</code></a>.
</p></li></ul>
</div>
<p>
        There are subtle implications to this approach:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Transaction events in the Performance Schema do not fully
            include the statement events associated with the
            corresponding <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">START
            TRANSACTION</code></a>,
            <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">COMMIT</code></a>, or
            <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">ROLLBACK</code></a>
            statements. There is a trivial amount of timing overlap
            between the transaction event and these statements.
          </p></li><li class="listitem"><p>
            Statements that work with nontransactional engines have no
            effect on the transaction state of the connection. For
            implicit transactions, the transaction event begins with the
            first statement that uses a transactional engine. This means
            that statements operating exclusively on nontransactional
            tables are ignored, even following
            <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">START
            TRANSACTION</code></a>.
</p></li></ul>
</div>
<p>
        To illustrate, consider the following scenario:
      </p><pre data-lang="none" class="programlisting">
1. SET autocommit = OFF;
2. CREATE TABLE t1 (a INT) ENGINE = InnoDB;
3. START TRANSACTION;                       -- Transaction 1 START
4. INSERT INTO t1 VALUES (1), (2), (3);
5. CREATE TABLE t2 (a INT) ENGINE = MyISAM; -- Transaction 1 COMMIT
                                            -- (implicit; DDL forces commit)
6. INSERT INTO t2 VALUES (1), (2), (3);     -- Update nontransactional table
7. UPDATE t2 SET a = a + 1;                 -- ... and again
8. INSERT INTO t1 VALUES (4), (5), (6);     -- Write to transactional table
                                            -- Transaction 2 START (implicit)
9. COMMIT;                                  -- Transaction 2 COMMIT
</pre><p>
        From the perspective of the server, Transaction 1 ends when
        table <code class="literal">t2</code> is created. Transaction 2 does not
        start until a transactional table is accessed, despite the
        intervening updates to nontransactional tables.
      </p><p>
        From the perspective of the Performance Schema, Transaction 2
        starts when the server transitions into an active transaction
        state. Statements 6 and 7 are not included within the boundaries
        of Transaction 2, which is consistent with how the server writes
        transactions to the binary log.
</p>
<h4><a name="performance-schema-transaction-tables-instrumentation"></a>Transaction Instrumentation</h4>
<p>
        Three attributes define transactions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Access mode (read only, read write)
          </p></li><li class="listitem"><p>
            Isolation level
            (<a class="link" href="innodb-storage-engine.html#isolevel_serializable"><code class="literal">SERIALIZABLE</code></a>,
            <a class="link" href="innodb-storage-engine.html#isolevel_repeatable-read"><code class="literal">REPEATABLE READ</code></a>, and so
            forth)
          </p></li><li class="listitem"><p>
            Implicit (<a class="link" href="server-administration.html#sysvar_autocommit"><code class="literal">autocommit</code></a>
            enabled) or explicit
            (<a class="link" href="server-administration.html#sysvar_autocommit"><code class="literal">autocommit</code></a> disabled)
</p></li></ul>
</div>
<p>
        To reduce complexity of the transaction instrumentation and to
        ensure that the collected transaction data provides complete,
        meaningful results, all transactions are instrumented
        independently of access mode, isolation level, or autocommit
        mode.
      </p><p>
        To selectively examine transaction history, use the attribute
        columns in the transaction event tables:
        <code class="literal">ACCESS_MODE</code>,
        <code class="literal">ISOLATION_LEVEL</code>, and
        <code class="literal">AUTOCOMMIT</code>.
      </p><p>
        The cost of transaction instrumentation can be reduced various
        ways, such as enabling or disabling transaction instrumentation
        according to user, account, host, or thread (client connection).
</p>
<h4><a name="performance-schema-transaction-tables-nested-events"></a>Transactions and Nested Events</h4>
<p>
        The parent of a transaction event is the event that initiated
        the transaction. For an explicitly started transaction, this
        includes the <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">START
        TRANSACTION</code></a> and
        <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">COMMIT AND
        CHAIN</code></a> statements. For an implicitly started
        transaction, it is the first statement that uses a transactional
        engine after the previous transaction ends.
      </p><p>
        In general, a transaction is the top-level parent to all events
        initiated during the transaction, including statements that
        explicitly end the transaction such as
        <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">COMMIT</code></a> and
        <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">ROLLBACK</code></a>.
        Exceptions are statements that implicitly end a transaction,
        such as DDL statements, in which case the current transaction
        must be committed before the new statement is executed.
</p>
<h4><a name="performance-schema-transaction-tables-stored-programs"></a>Transactions and Stored Programs</h4>
<p>
        Transactions and stored program events are related as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Stored Procedures
          </p><p>
            Stored procedures operate independently of transactions. A
            stored procedure can be started within a transaction, and a
            transaction can be started or ended from within a stored
            procedure. If called from within a transaction, a stored
            procedure can execute statements that force a commit of the
            parent transaction and then start a new transaction.
          </p><p>
            If a stored procedure is started within a transaction, that
            transaction is the parent of the stored procedure event.
          </p><p>
            If a transaction is started by a stored procedure, the
            stored procedure is the parent of the transaction event.
          </p></li><li class="listitem"><p>
            Stored Functions
          </p><p>
            Stored functions are restricted from causing an explicit or
            implicit commit or rollback. Stored function events can
            reside within a parent transaction event.
          </p></li><li class="listitem"><p>
            Triggers
          </p><p>
            Triggers activate as part of a statement that accesses the
            table with which it is associated, so the parent of a
            trigger event is always the statement that activates it.
          </p><p>
            Triggers cannot issue statements that cause an explicit or
            implicit commit or rollback of a transaction.
          </p></li><li class="listitem"><p>
            Scheduled Events
          </p><p>
            The execution of the statements in the body of a scheduled
            event takes place in a new connection. Nesting of a
            scheduled event within a parent transaction is not
            applicable.
</p></li></ul>
</div>
<h4><a name="performance-schema-transaction-tables-savepoints"></a>Transactions and Savepoints</h4>
<p>
        Savepoint statements are recorded as separate statement events.
        Transaction events include separate counters for
        <a class="link" href="sql-syntax.html#savepoint" title="13.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Syntax"><code class="literal">SAVEPOINT</code></a>,
        <a class="link" href="sql-syntax.html#savepoint" title="13.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Syntax"><code class="literal">ROLLBACK TO
        SAVEPOINT</code></a>, and
        <a class="link" href="sql-syntax.html#savepoint" title="13.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Syntax"><code class="literal">RELEASE
        SAVEPOINT</code></a> statements issued during the transaction.
</p>
<h4><a name="performance-schema-transaction-tables-errors"></a>Transactions and Errors</h4>
<p>
        Errors and warnings that occur within a transaction are recorded
        in statement events, but not in the corresponding transaction
        event. This includes transaction-specific errors and warnings,
        such as a rollback on a nontransactional table or GTID
        consistency errors.
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-transactions-current-table"></a>25.11.7.1 The events_transactions_current Table</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm139684628817712"></a><a class="indexterm" name="idm139684628816208"></a><p>
          The <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>
          table contains current transaction events, one row per thread
          showing the current status of the thread's most recent
          monitored transaction event. For example:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM events_transactions_current LIMIT 1\G</code></strong>
*************************** 1. row ***************************
                      THREAD_ID: 26
                       EVENT_ID: 7
                   END_EVENT_ID: NULL
                     EVENT_NAME: transaction
                          STATE: ACTIVE
                         TRX_ID: NULL
                           GTID: 3E11FA47-71CA-11E1-9E33-C80AA9429562:56
                            XID: NULL
                       XA_STATE: NULL
                         SOURCE: transaction.cc:150
                    TIMER_START: 420833537900000
                      TIMER_END: NULL
                     TIMER_WAIT: NULL
                    ACCESS_MODE: READ WRITE
                ISOLATION_LEVEL: REPEATABLE READ
                     AUTOCOMMIT: NO
           NUMBER_OF_SAVEPOINTS: 0
NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0
    NUMBER_OF_RELEASE_SAVEPOINT: 0
          OBJECT_INSTANCE_BEGIN: NULL
               NESTING_EVENT_ID: 6
             NESTING_EVENT_TYPE: STATEMENT
</pre><p>
          Of the tables that contain transaction event rows,
          <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a> is
          the most fundamental. Other tables that contain transaction
          event rows are logically derived from the current events. For
          example, the
          <a class="link" href="performance-schema.html#events-transactions-history-table" title="25.11.7.2 The events_transactions_history Table"><code class="literal">events_transactions_history</code></a> and
          <a class="link" href="performance-schema.html#events-transactions-history-long-table" title="25.11.7.3 The events_transactions_history_long Table"><code class="literal">events_transactions_history_long</code></a>
          tables are collections of the most recent transaction events,
          up to a fixed number of rows.
        </p><p>
          For information about configuration of transaction event
          collection, see
          <a class="xref" href="performance-schema.html#performance-schema-transaction-tables" title="25.11.7 Performance Schema Transaction Tables">Section 25.11.7, “Performance Schema Transaction Tables”</a>.
        </p><p>
          The <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>
          table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">THREAD_ID</code>, <code class="literal">EVENT_ID</code>
            </p><p>
              The thread associated with the event and the thread
              current event number when the event starts. The
              <code class="literal">THREAD_ID</code> and
              <code class="literal">EVENT_ID</code> values taken together uniquely
              identify the row. No two rows have the same pair of
              values.
            </p></li><li class="listitem"><p>
              <code class="literal">END_EVENT_ID</code>
            </p><p>
              This column is set to <code class="literal">NULL</code> when the
              event starts and updated to the thread current event
              number when the event ends.
            </p></li><li class="listitem"><p>
              <code class="literal">EVENT_NAME</code>
            </p><p>
              The name of the instrument from which the event was
              collected. This is a <code class="literal">NAME</code> value from
              the <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
              Instrument names may have multiple parts and form a
              hierarchy, as discussed in
              <a class="xref" href="performance-schema.html#performance-schema-instrument-naming" title="25.6 Performance Schema Instrument Naming Conventions">Section 25.6, “Performance Schema Instrument Naming Conventions”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">STATE</code>
            </p><p>
              The current transaction state. The value is
              <code class="literal">ACTIVE</code> (after
              <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">START
              TRANSACTION</code></a> or
              <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">BEGIN</code></a>),
              <code class="literal">COMMITTED</code> (after
              <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">COMMIT</code></a>), or <code class="literal">ROLLED
              BACK</code> (after
              <a class="link" href="sql-syntax.html#commit" title="13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax"><code class="literal">ROLLBACK</code></a>).
            </p></li><li class="listitem"><p>
              <code class="literal">TRX_ID</code>
            </p><p>
              Unused.
            </p></li><li class="listitem"><p>
              <code class="literal">GTID</code>
            </p><p>
              The GTID column contains the value of
              <a class="link" href="replication.html#sysvar_gtid_next"><code class="literal">gtid_next</code></a>, which can be
              one of <code class="literal">ANONYMOUS</code>,
              <code class="literal">AUTOMATIC</code>, or a GTID using the format
              <code class="literal">UUID:NUMBER</code>. For transactions that use
              <a class="link" href="replication.html#sysvar_gtid_next"><code class="literal">gtid_next=AUTOMATIC</code></a>,
              which is all normal client transactions, the GTID column
              changes when the transaction commits and the actual GTID
              is assigned. If <a class="link" href="replication.html#sysvar_gtid_mode"><code class="literal">gtid_mode</code></a>
              is either <code class="literal">ON</code> or
              <code class="literal">ON_PERMISSIVE</code>, the GTID column changes
              to the transaction's GTID. If <code class="literal">gtid_mode</code>
              is either <code class="literal">OFF</code> or
              <code class="literal">OFF_PERMISSIVE</code>, the GTID column changes
              to <code class="literal">ANONYMOUS</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">XID_FORMAT_ID</code>,
              <code class="literal">XID_GTRID</code>, and
              <code class="literal">XID_BQUAL</code>
            </p><p>
              The components of the XA transaction identifier. They have
              the format described in <a class="xref" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax">Section 13.3.7.1, “XA Transaction SQL Syntax”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">XA_STATE</code>
            </p><p>
              The state of the XA transaction. The value is
              <code class="literal">ACTIVE</code> (after
              <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
              START</code></a>), <code class="literal">IDLE</code> (after
              <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
              END</code></a>), <code class="literal">PREPARED</code> (after
              <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
              PREPARE</code></a>), <code class="literal">ROLLED BACK</code> (after
              <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
              ROLLBACK</code></a>), or <code class="literal">COMMITTED</code>
              (after <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
              COMMIT</code></a>).
            </p><p>
              On a replication slave, the same XA transaction can appear
              in the
              <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>
              table with different states on different threads. This is
              because immediately after the XA transaction is prepared,
              it is detached from the slave applier thread, and can be
              committed or rolled back by any thread on the slave. The
              <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>
              table displays the current status of the most recent
              monitored transaction event on the thread, and does not
              update this status when the thread is idle. So the XA
              transaction can still be displayed in the
              <code class="literal">PREPARED</code> state for the original applier
              thread, after it has been processed by another thread. To
              positively identify XA transactions that are still in the
              <code class="literal">PREPARED</code> state and need to be
              recovered, use the
              <a class="link" href="sql-syntax.html#xa-statements" title="13.3.7.1 XA Transaction SQL Syntax"><code class="literal">XA
              RECOVER</code></a> statement rather than the Performance
              Schema transaction tables.
            </p></li><li class="listitem"><p>
              <code class="literal">SOURCE</code>
            </p><p>
              The name of the source file containing the instrumented
              code that produced the event and the line number in the
              file at which the instrumentation occurs. This enables you
              to check the source to determine exactly what code is
              involved.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_START</code>,
              <code class="literal">TIMER_END</code>,
              <code class="literal">TIMER_WAIT</code>
            </p><p>
              Timing information for the event. The unit for these
              values is picoseconds (trillionths of a second). The
              <code class="literal">TIMER_START</code> and
              <code class="literal">TIMER_END</code> values indicate when event
              timing started and ended. <code class="literal">TIMER_WAIT</code> is
              the event elapsed time (duration).
            </p><p>
              If an event has not finished, <code class="literal">TIMER_END</code>
              is the current timer value and
              <code class="literal">TIMER_WAIT</code> is the time elapsed so far
              (<code class="literal">TIMER_END</code> −
              <code class="literal">TIMER_START</code>).
            </p><p>
              If an event is produced from an instrument that has
              <code class="literal">TIMED = NO</code>, timing information is not
              collected, and <code class="literal">TIMER_START</code>,
              <code class="literal">TIMER_END</code>, and
              <code class="literal">TIMER_WAIT</code> are all
              <code class="literal">NULL</code>.
            </p><p>
              For discussion of picoseconds as the unit for event times
              and factors that affect time values, see
              <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">ACCESS_MODE</code>
            </p><p>
              The transaction access mode. The value is <code class="literal">READ
              ONLY</code> or <code class="literal">READ WRITE</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">ISOLATION_LEVEL</code>
            </p><p>
              The transaction isolation level. The value is
              <a class="link" href="innodb-storage-engine.html#isolevel_repeatable-read"><code class="literal">REPEATABLE READ</code></a>,
              <a class="link" href="innodb-storage-engine.html#isolevel_read-committed"><code class="literal">READ COMMITTED</code></a>,
              <a class="link" href="innodb-storage-engine.html#isolevel_read-uncommitted"><code class="literal">READ UNCOMMITTED</code></a>, or
              <a class="link" href="innodb-storage-engine.html#isolevel_serializable"><code class="literal">SERIALIZABLE</code></a>.
            </p></li><li class="listitem"><p>
              <code class="literal">AUTOCOMMIT</code>
            </p><p>
              Whether autcommit mode was enabled when the transaction
              started.
            </p></li><li class="listitem"><p>
              <code class="literal">NUMBER_OF_SAVEPOINTS</code>,
              <code class="literal">NUMBER_OF_ROLLBACK_TO_SAVEPOINT</code>,
              <code class="literal">NUMBER_OF_RELEASE_SAVEPOINT</code>
            </p><p>
              The number of <a class="link" href="sql-syntax.html#savepoint" title="13.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Syntax"><code class="literal">SAVEPOINT</code></a>,
              <a class="link" href="sql-syntax.html#savepoint" title="13.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Syntax"><code class="literal">ROLLBACK TO
              SAVEPOINT</code></a>, and
              <a class="link" href="sql-syntax.html#savepoint" title="13.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Syntax"><code class="literal">RELEASE
              SAVEPOINT</code></a> statements issued during the
              transaction.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              Unused.
            </p></li><li class="listitem"><p>
              <code class="literal">NESTING_EVENT_ID</code>
            </p><p>
              The <code class="literal">EVENT_ID</code> value of the event within
              which this event is nested.
            </p></li><li class="listitem"><p>
              <code class="literal">NESTING_EVENT_TYPE</code>
            </p><p>
              The nesting event type. The value is
              <code class="literal">TRANSACTION</code>,
              <code class="literal">STATEMENT</code>, <code class="literal">STAGE</code>, or
              <code class="literal">WAIT</code>. (<code class="literal">TRANSACTION</code>
              will not appear because transactions cannot be nested.)
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>
          table. It removes the rows.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-transactions-history-table"></a>25.11.7.2 The events_transactions_history Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684628694512"></a><a class="indexterm" name="idm139684628693008"></a><p>
          The <a class="link" href="performance-schema.html#events-transactions-history-table" title="25.11.7.2 The events_transactions_history Table"><code class="literal">events_transactions_history</code></a>
          table contains the most recent <em class="replaceable"><code>N</code></em>
          transaction events per thread. The value of
          <em class="replaceable"><code>N</code></em> is autosized at server startup.
          To set the table size explicitly, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_transactions_history_size"><code class="literal">performance_schema_events_transactions_history_size</code></a>
          system variable at server startup. Transaction events are not
          added to the table until they have ended. As new events are
          added, older events are discarded if the table is full.
        </p><p>
          The <a class="link" href="performance-schema.html#events-transactions-history-table" title="25.11.7.2 The events_transactions_history Table"><code class="literal">events_transactions_history</code></a>
          table has the same structure as
          <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>. See
          <a class="xref" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table">Section 25.11.7.1, “The events_transactions_current Table”</a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the <a class="link" href="performance-schema.html#events-transactions-history-table" title="25.11.7.2 The events_transactions_history Table"><code class="literal">events_transactions_history</code></a>
          table. It removes the rows.
        </p><p>
          For information about configuration of transaction event
          collection, see
          <a class="xref" href="performance-schema.html#performance-schema-transaction-tables" title="25.11.7 Performance Schema Transaction Tables">Section 25.11.7, “Performance Schema Transaction Tables”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="events-transactions-history-long-table"></a>25.11.7.3 The events_transactions_history_long Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684628677952"></a><a class="indexterm" name="idm139684628676496"></a><p>
          The
          <a class="link" href="performance-schema.html#events-transactions-history-long-table" title="25.11.7.3 The events_transactions_history_long Table"><code class="literal">events_transactions_history_long</code></a>
          table contains the most recent <em class="replaceable"><code>N</code></em>
          transaction events. The value of <em class="replaceable"><code>N</code></em>
          is autosized at server startup. To set the table size
          explicitly, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_transactions_history_long_size"><code class="literal">performance_schema_events_transactions_history_long_size</code></a>
          system variable at server startup. Transaction events are not
          added to the table until they have ended. As new events are
          added, older events are discarded if the table is full. When a
          thread ends, its rows are removed from the table.
        </p><p>
          The
          <a class="link" href="performance-schema.html#events-transactions-history-long-table" title="25.11.7.3 The events_transactions_history_long Table"><code class="literal">events_transactions_history_long</code></a>
          table has the same structure as
          <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>. See
          <a class="xref" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table">Section 25.11.7.1, “The events_transactions_current Table”</a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the
          <a class="link" href="performance-schema.html#events-transactions-history-long-table" title="25.11.7.3 The events_transactions_history_long Table"><code class="literal">events_transactions_history_long</code></a>
          table. It removes the rows.
        </p><p>
          For information about configuration of transaction event
          collection, see
          <a class="xref" href="performance-schema.html#performance-schema-transaction-tables" title="25.11.7 Performance Schema Transaction Tables">Section 25.11.7, “Performance Schema Transaction Tables”</a>.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-connection-tables"></a>25.11.8 Performance Schema Connection Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#accounts-table">25.11.8.1 The accounts Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#hosts-table">25.11.8.2 The hosts Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#users-table">25.11.8.3 The users Table</a></span></dt></dl>
</div>
<p>
        When a client connects to the MySQL server, it does so under a
        particular user name and from a particular host. The Performance
        Schema provides statistics about these connections, tracking
        them per account (user and host combination) as well as
        separately per user name and host name, using these tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a>: Connection statistics
            per client account
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a>: Connection statistics
            per client host name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a>: Connection statistics
            per client user name
</p></li></ul>
</div>
<p>
        The meaning of <span class="quote">“<span class="quote">account</span>”</span> in the connection tables
        is similar to its meaning in the MySQL grant tables in the
        <code class="literal">mysql</code> system database, in the sense that the
        term refers to a combination of user and host values. They
        differ in that, for grant tables, the host part of an account
        can be a pattern, whereas for Performance Schema tables, the
        host value is always a specific nonpattern host name.
      </p><p>
        Each connection table has <code class="literal">CURRENT_CONNECTIONS</code>
        and <code class="literal">TOTAL_CONNECTIONS</code> columns to track the
        current and total number of connections per <span class="quote">“<span class="quote">tracking
        value</span>”</span> on which its statistics are based. The tables
        differ in what they use for the tracking value. The
        <a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a> table has
        <code class="literal">USER</code> and <code class="literal">HOST</code> columns to
        track connections per user and host combination. The
        <a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a> and
        <a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a> tables have a
        <code class="literal">USER</code> and <code class="literal">HOST</code> column,
        respectively, to track connections per user name and host name.
      </p><p>
        The Performance Schema also counts internal threads and threads
        for user sessions that failed to authenticate, using rows with
        <code class="literal">USER</code> and <code class="literal">HOST</code> column
        values of <code class="literal">NULL</code>.
      </p><p>
        Suppose that clients named <code class="literal">user1</code> and
        <code class="literal">user2</code> each connect one time from
        <code class="literal">hosta</code> and <code class="literal">hostb</code>. The
        Performance Schema tracks the connections as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a> table has four
            rows, for the
            <code class="literal">user1</code>/<code class="literal">hosta</code>,
            <code class="literal">user1</code>/<code class="literal">hostb</code>,
            <code class="literal">user2</code>/<code class="literal">hosta</code>, and
            <code class="literal">user2</code>/<code class="literal">hostb</code> account
            values, each row counting one connection per account.
          </p></li><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a> table has two rows,
            for <code class="literal">hosta</code> and <code class="literal">hostb</code>,
            each row counting two connections per host name.
          </p></li><li class="listitem"><p>
            The <a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a> table has two rows,
            for <code class="literal">user1</code> and <code class="literal">user2</code>,
            each row counting two connections per user name.
</p></li></ul>
</div>
<p>
        When a client connects, the Performance Schema determines which
        row in each connection table applies, using the tracking value
        appropriate to each table. If there is no such row, one is
        added. Then the Performance Schema increments by one the
        <code class="literal">CURRENT_CONNECTIONS</code> and
        <code class="literal">TOTAL_CONNECTIONS</code> columns in that row.
      </p><p>
        When a client disconnects, the Performance Schema decrements by
        one the <code class="literal">CURRENT_CONNECTIONS</code> column in the row
        and leaves the <code class="literal">TOTAL_CONNECTIONS</code> column
        unchanged.
      </p><p>
        <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
        connection tables. It has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Rows are removed for accounts, hosts, or users that have no
            current connections (rows with <code class="literal">CURRENT_CONNECTIONS
            = 0</code>).
          </p></li><li class="listitem"><p>
            Nonremoved rows are reset to count only current connections:
            For rows with <code class="literal">CURRENT_CONNECTIONS &gt; 0</code>,
            <code class="literal">TOTAL_CONNECTIONS</code> is reset to
            <code class="literal">CURRENT_CONNECTIONS</code>.
          </p></li><li class="listitem"><p>
            Summary tables that depend on the connection table are
            implicitly truncated, as described later in this section.
</p></li></ul>
</div>
<p>
        The Performance Schema maintains summary tables that aggregate
        connection statistics for various event types by account, host,
        or user. These tables have
        <code class="literal">_summary_by_account</code>,
        <code class="literal">_summary_by_host</code>, or
        <code class="literal">_summary_by_user</code> in the name. To identify
        them, use this query:
      </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES</code></strong>
       <strong class="userinput"><code>WHERE TABLE_SCHEMA = 'performance_schema'</code></strong>
       <strong class="userinput"><code>AND TABLE_NAME REGEXP '_summary_by_(account|host|user)'</code></strong>
       <strong class="userinput"><code>ORDER BY TABLE_NAME;</code></strong>
+------------------------------------------------------+
| TABLE_NAME                                           |
+------------------------------------------------------+
| events_stages_summary_by_account_by_event_name       |
| events_stages_summary_by_host_by_event_name          |
| events_stages_summary_by_user_by_event_name          |
| events_statements_summary_by_account_by_event_name   |
| events_statements_summary_by_host_by_event_name      |
| events_statements_summary_by_user_by_event_name      |
| events_transactions_summary_by_account_by_event_name |
| events_transactions_summary_by_host_by_event_name    |
| events_transactions_summary_by_user_by_event_name    |
| events_waits_summary_by_account_by_event_name        |
| events_waits_summary_by_host_by_event_name           |
| events_waits_summary_by_user_by_event_name           |
| memory_summary_by_account_by_event_name              |
| memory_summary_by_host_by_event_name                 |
| memory_summary_by_user_by_event_name                 |
+------------------------------------------------------+
</pre><p>
        For details about individual connection summary tables, consult
        the section that describes tables for the summarized event type:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Wait event summaries: <a class="xref" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables">Section 25.11.15.1, “Wait Event Summary Tables”</a>
          </p></li><li class="listitem"><p>
            Stage event summaries:
            <a class="xref" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables">Section 25.11.15.2, “Stage Summary Tables”</a>
          </p></li><li class="listitem"><p>
            Statement event summaries:
            <a class="xref" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables">Section 25.11.15.3, “Statement Summary Tables”</a>
          </p></li><li class="listitem"><p>
            Transaction event summaries:
            <a class="xref" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables">Section 25.11.15.4, “Transaction Summary Tables”</a>
          </p></li><li class="listitem"><p>
            Memory event summaries:
            <a class="xref" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables">Section 25.11.15.9, “Memory Summary Tables”</a>
</p></li></ul>
</div>
<p>
        <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
        connection summary tables. It removes rows for accounts, hosts,
        or users with no connections, and resets the summary columns to
        zero for the remaining rows. In addition, each summary table
        that is aggregated by account, host, user, or thread is
        implicitly truncated by truncation of the connection table on
        which it depends. The following table describes the relationship
        between connection table truncation and implicitly truncated
        tables.
</p>
<div class="table">
<a name="idm139684628591584"></a><p class="title"><b>Table 25.2 Implicit Effects of Connection Table Truncation</b></p>
<div class="table-contents">
<table summary="Which Performance Schema summary tables are implicity truncated by connection table truncation."><col width="40%"><col width="60%"><thead><tr>
            <th scope="col">Truncated Connection Table</th>
            <th scope="col">Implicitly Truncated Summary Tables</th>
          </tr></thead><tbody><tr>
            <td scope="row"><code class="literal">accounts</code></td>
            <td>Tables with names containing <code class="literal">_summary_by_account</code>,
              <code class="literal">_summary_by_thread</code></td>
          </tr><tr>
            <td scope="row"><code class="literal">hosts</code></td>
            <td>Tables with names containing <code class="literal">_summary_by_account</code>,
              <code class="literal">_summary_by_host</code>,
              <code class="literal">_summary_by_thread</code></td>
          </tr><tr>
            <td scope="row"><code class="literal">users</code></td>
            <td>Tables with names containing <code class="literal">_summary_by_account</code>,
              <code class="literal">_summary_by_user</code>,
              <code class="literal">_summary_by_thread</code></td>
</tr></tbody></table>
</div>

</div>
<br class="table-break"><p>
        Truncating a <code class="literal">_summary_global</code> summary table
        also implicitly truncates its corresponding connection and
        thread summary tables. For example, truncating
        <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_global_by_event_name</code></a>
        implicitly truncates the wait event summary tables that are
        aggregated by account, host, user, or thread.
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="accounts-table"></a>25.11.8.1 The accounts Table</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm139684628567952"></a><a class="indexterm" name="idm139684628566464"></a><p>
          The <a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a> table contains a row
          for each account that has connected to the MySQL server. For
          each account, the table counts the current and total number of
          connections. The table size is autosized at server startup. To
          set the table size explicitly, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_accounts_size"><code class="literal">performance_schema_accounts_size</code></a>
          system variable at server startup. To disable account
          statistics, set this variable to 0.
        </p><p>
          The <a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a> table has the
          following columns. For a description of how the Performance
          Schema maintains rows in this table, including the effect of
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a>, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-tables" title="25.11.8 Performance Schema Connection Tables">Section 25.11.8, “Performance Schema Connection Tables”</a>.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">USER</code>
            </p><p>
              The client user name for the connection. This is
              <code class="literal">NULL</code> for an internal thread, or for a
              user session that failed to authenticate.
            </p></li><li class="listitem"><p>
              <code class="literal">HOST</code>
            </p><p>
              The host from which the client connected. This is
              <code class="literal">NULL</code> for an internal thread, or for a
              user session that failed to authenticate.
            </p></li><li class="listitem"><p>
              <code class="literal">CURRENT_CONNECTIONS</code>
            </p><p>
              The current number of connections for the account.
            </p></li><li class="listitem"><p>
              <code class="literal">TOTAL_CONNECTIONS</code>
            </p><p>
              The total number of connections for the account.
</p></li></ul>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="hosts-table"></a>25.11.8.2 The hosts Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684628546864"></a><a class="indexterm" name="idm139684628545376"></a><p>
          The <a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a> table contains a row
          for each host from which clients have connected to the MySQL
          server. For each host name, the table counts the current and
          total number of connections. The table size is autosized at
          server startup. To set the table size explicitly, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_hosts_size"><code class="literal">performance_schema_hosts_size</code></a>
          system variable at server startup. To disable host statistics,
          set this variable to 0.
        </p><p>
          The <a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a> table has the following
          columns. For a description of how the Performance Schema
          maintains rows in this table, including the effect of
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a>, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-tables" title="25.11.8 Performance Schema Connection Tables">Section 25.11.8, “Performance Schema Connection Tables”</a>.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">HOST</code>
            </p><p>
              The host from which the client connected. This is
              <code class="literal">NULL</code> for an internal thread, or for a
              user session that failed to authenticate.
            </p></li><li class="listitem"><p>
              <code class="literal">CURRENT_CONNECTIONS</code>
            </p><p>
              The current number of connections for the host.
            </p></li><li class="listitem"><p>
              <code class="literal">TOTAL_CONNECTIONS</code>
            </p><p>
              The total number of connections for the host.
</p></li></ul>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="users-table"></a>25.11.8.3 The users Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684628528608"></a><a class="indexterm" name="idm139684628527120"></a><p>
          The <a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a> table contains a row
          for each user who has connected to the MySQL server. For each
          user name, the table counts the current and total number of
          connections. The table size is autosized at server startup. To
          set the table size explicitly, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_users_size"><code class="literal">performance_schema_users_size</code></a>
          system variable at server startup. To disable user statistics,
          set this variable to 0.
        </p><p>
          The <a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a> table has the following
          columns. For a description of how the Performance Schema
          maintains rows in this table, including the effect of
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a>, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-tables" title="25.11.8 Performance Schema Connection Tables">Section 25.11.8, “Performance Schema Connection Tables”</a>.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">USER</code>
            </p><p>
              The client user name for the connection. This is
              <code class="literal">NULL</code> for an internal thread, or for a
              user session that failed to authenticate.
            </p></li><li class="listitem"><p>
              <code class="literal">CURRENT_CONNECTIONS</code>
            </p><p>
              The current number of connections for the user.
            </p></li><li class="listitem"><p>
              <code class="literal">TOTAL_CONNECTIONS</code>
            </p><p>
              The total number of connections for the user.
</p></li></ul>
</div>

</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-connection-attribute-tables"></a>25.11.9 Performance Schema Connection Attribute Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#session-account-connect-attrs-table">25.11.9.1 The session_account_connect_attrs Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#session-connect-attrs-table">25.11.9.2 The session_connect_attrs Table</a></span></dt></dl>
</div>
<p>
        Application programs can provide key/value pairs as connection
        attributes to be passed to the server at connect time. For the C
        API, define the attribute set using the
        <a class="link" href="connectors-apis.html#mysql-options" title="27.8.7.50 mysql_options()"><code class="literal">mysql_options()</code></a> and
        <a class="link" href="connectors-apis.html#mysql-options4" title="27.8.7.51 mysql_options4()"><code class="literal">mysql_options4()</code></a> functions.
        Other MySQL Connectors may provide their own
        attribute-definition methods.
      </p><p>
        These tables expose attribute information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#session-account-connect-attrs-table" title="25.11.9.1 The session_account_connect_attrs Table"><code class="literal">session_account_connect_attrs</code></a>:
            Connection attributes for the current session, and other
            sessions associated with the session account
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#session-connect-attrs-table" title="25.11.9.2 The session_connect_attrs Table"><code class="literal">session_connect_attrs</code></a>:
            Connection attributes for all sessions
</p></li></ul>
</div>
<p>
        Attribute names that begin with an underscore
        (<code class="literal">_</code>) are reserved for internal use and should
        not be created by application programs. This convention permits
        new attributes to be introduced by MySQL without colliding with
        application attributes.
      </p><p>
        The set of connection attributes visible on a given connection
        varies depending on your platform and MySQL Connector used to
        establish the connection.
      </p><p>
        The <code class="literal">libmysqlclient</code> client library (provided
        in MySQL and MySQL Connector/C distributions) sets these attributes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">_client_name</code>: The client name
            (<code class="literal">libmysql</code> for the client library)
          </p></li><li class="listitem"><p>
            <code class="literal">_client_version</code>: The client library
            version
          </p></li><li class="listitem"><p>
            <code class="literal">_os</code>: The operating system (for example,
            <code class="literal">Linux</code>, <code class="literal">Win64</code>)
          </p></li><li class="listitem"><p>
            <code class="literal">_pid</code>: The client process ID
          </p></li><li class="listitem"><p>
            <code class="literal">_platform</code>: The machine platform (for
            example, <code class="literal">x86_64</code>)
          </p></li><li class="listitem"><p>
            <code class="literal">_thread</code>: The client thread ID (Windows
            only)
</p></li></ul>
</div>
<p>
        Other MySQL Connectors may define their own connection
        attributes.
      </p><p>
        MySQL Connector/J defines these attributes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">_client_license</code>: The connector license
            type
          </p></li><li class="listitem"><p>
            <code class="literal">_runtime_vendor</code>: The Java runtime
            environment (JRE) vendor
          </p></li><li class="listitem"><p>
            <code class="literal">_runtime_version</code>: The Java runtime
            environment (JRE) version
</p></li></ul>
</div>
<p>
        MySQL Connector/NET defines these attributes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">_client_version</code>: The client library
            version
          </p></li><li class="listitem"><p>
            <code class="literal">_os</code>: The operating system (for example,
            <code class="literal">Linux</code>, <code class="literal">Win64</code>)
          </p></li><li class="listitem"><p>
            <code class="literal">_pid</code>: The client process ID
          </p></li><li class="listitem"><p>
            <code class="literal">_platform</code>: The machine platform (for
            example, <code class="literal">x86_64</code>)
          </p></li><li class="listitem"><p>
            <code class="literal">_program_name</code>: The client name
          </p></li><li class="listitem"><p>
            <code class="literal">_thread</code>: The client thread ID (Windows
            only)
</p></li></ul>
</div>
<p>
        PHP defines attributes that depend on how it was compiled:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Compiled using <code class="literal">libmysqlclient</code>: The
            standard <code class="literal">libmysqlclient</code> attributes,
            described previously
          </p></li><li class="listitem"><p>
            Compiled using <code class="literal">mysqlnd</code>: Only the
            <code class="literal">_client_name</code> attribute, with a value of
            <code class="literal">mysqlnd</code>
</p></li></ul>
</div>
<p>
        Many MySQL client programs set a <code class="literal">program_name</code>
        attribute with a value equal to the client name. For example,
        <a class="link" href="programs.html#mysqladmin" title="4.5.2 mysqladmin — Client for Administering a MySQL Server"><span class="command"><strong>mysqladmin</strong></span></a> and <a class="link" href="programs.html#mysqldump" title="4.5.4 mysqldump — A Database Backup Program"><span class="command"><strong>mysqldump</strong></span></a>
        set <code class="literal">program_name</code> to
        <code class="literal">mysqladmin</code> and <code class="literal">mysqldump</code>,
        respectively.
      </p><p>
        Some MySQL client programs define additional attributes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="programs.html#mysqlbinlog" title="4.6.7 mysqlbinlog — Utility for Processing Binary Log Files"><span class="command"><strong>mysqlbinlog</strong></span></a> defines the
            <code class="literal">_client_role</code> attribute as
            <code class="literal">binary_log_listener</code>.
          </p></li><li class="listitem"><p>
            Replication slave connections define
            <code class="literal">program_name</code> as
            <code class="literal">mysqld</code>, <code class="literal">_client_role</code>
            as <code class="literal">binary_log_listener</code>, and
            <code class="literal">_client_replication_channel_name</code> as the
            channel name.
          </p></li><li class="listitem"><p>
            <a class="link" href="storage-engines.html#federated-storage-engine" title="15.8 The FEDERATED Storage Engine"><code class="literal">FEDERATED</code></a> storage engine
            connections define <code class="literal">program_name</code> as
            <code class="literal">mysqld</code> and
            <code class="literal">_client_role</code> as
            <code class="literal">federated_storage</code>.
</p></li></ul>
</div>
<p>
        There are limits on the amount of connection attribute data
        transmitted from client to server: A fixed limit imposed by the
        client prior to connect time; a fixed limit imposed by the
        server at connect time; and a configurable limit imposed by the
        Performance Schema at connect time.
      </p><p>
        For connections initiated using the C API, the
        <code class="literal">libmysqlclient</code> library imposes a limit of
        64KB on the aggregate size of connection attribute data on the
        client side: Calls to
        <a class="link" href="connectors-apis.html#mysql-options" title="27.8.7.50 mysql_options()"><code class="literal">mysql_options()</code></a> that cause this
        limit to be exceeded produce a
        <a class="link" href="error-handling.html#error_cr_invalid_parameter_no"><code class="literal">CR_INVALID_PARAMETER_NO</code></a> error.
        Other MySQL Connectors may impose their own client-side limits
        on how much connection attribute data can be transmitted to the
        server.
      </p><p>
        On the server side, these size checks on connection attribute
        data occur:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The server imposes a limit of 64KB on the aggregate size of
            connection attribute data it will accept. If a client
            attempts to send more than 64KB of attribute data, the
            server rejects the connection.
          </p></li><li class="listitem"><p>
            For accepted connections, the Performance Schema checks
            aggregate attribute size against the value of the
            <a class="link" href="performance-schema.html#sysvar_performance_schema_session_connect_attrs_size"><code class="literal">performance_schema_session_connect_attrs_size</code></a>
            system variable. If attribute size exceeds this value, these
            actions take place:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                The Performance Schema truncates the attribute data and
                increments the
                <a class="link" href="performance-schema.html#statvar_Performance_schema_session_connect_attrs_lost"><code class="literal">Performance_schema_session_connect_attrs_lost</code></a>
                status variable, which indicates the number of
                connections for which attribute truncation occurred.
              </p></li><li class="listitem"><p>
                The Performance Schema writes a message to the error log
                if the
                <a class="link" href="server-administration.html#sysvar_log_error_verbosity"><code class="literal">log_error_verbosity</code></a>
                system variable is greater than 1:
              </p><pre data-lang="none" class="programlisting">
[Warning] Connection attributes of length <em class="replaceable"><code>N</code></em> were truncated
</pre></li></ul>
</div>
</li></ul>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="session-account-connect-attrs-table"></a>25.11.9.1 The session_account_connect_attrs Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684628425808"></a><a class="indexterm" name="idm139684628424304"></a><p>
          Application programs can provide key/value connection
          attributes to be passed to the server at connect time, using
          the <a class="link" href="connectors-apis.html#mysql-options" title="27.8.7.50 mysql_options()"><code class="literal">mysql_options()</code></a> and
          <a class="link" href="connectors-apis.html#mysql-options4" title="27.8.7.51 mysql_options4()"><code class="literal">mysql_options4()</code></a> C API
          functions. For descriptions of common attributes, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-attribute-tables" title="25.11.9 Performance Schema Connection Attribute Tables">Section 25.11.9, “Performance Schema Connection Attribute Tables”</a>.
        </p><p>
          The <a class="link" href="performance-schema.html#session-account-connect-attrs-table" title="25.11.9.1 The session_account_connect_attrs Table"><code class="literal">session_account_connect_attrs</code></a>
          table contains connection attributes only for sessions for
          your own account. To see connection attributes for all
          sessions, look in the
          <a class="link" href="performance-schema.html#session-connect-attrs-table" title="25.11.9.2 The session_connect_attrs Table"><code class="literal">session_connect_attrs</code></a> table.
        </p><p>
          The <a class="link" href="performance-schema.html#session-account-connect-attrs-table" title="25.11.9.1 The session_account_connect_attrs Table"><code class="literal">session_account_connect_attrs</code></a>
          table contains these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">PROCESSLIST_ID</code>
            </p><p>
              The connection identifier for the session.
            </p></li><li class="listitem"><p>
              <code class="literal">ATTR_NAME</code>
            </p><p>
              The attribute name.
            </p></li><li class="listitem"><p>
              <code class="literal">ATTR_VALUE</code>
            </p><p>
              The attribute value.
            </p></li><li class="listitem"><p>
              <code class="literal">ORDINAL_POSITION</code>
            </p><p>
              The order in which the attribute was added to the set of
              connection attributes.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the
          <a class="link" href="performance-schema.html#session-account-connect-attrs-table" title="25.11.9.1 The session_account_connect_attrs Table"><code class="literal">session_account_connect_attrs</code></a>
          table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="session-connect-attrs-table"></a>25.11.9.2 The session_connect_attrs Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684628401760"></a><a class="indexterm" name="idm139684628400256"></a><p>
          Application programs can provide key/value connection
          attributes to be passed to the server at connect time, using
          the <a class="link" href="connectors-apis.html#mysql-options" title="27.8.7.50 mysql_options()"><code class="literal">mysql_options()</code></a> and
          <a class="link" href="connectors-apis.html#mysql-options4" title="27.8.7.51 mysql_options4()"><code class="literal">mysql_options4()</code></a> C API
          functions. For descriptions of common attributes, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-attribute-tables" title="25.11.9 Performance Schema Connection Attribute Tables">Section 25.11.9, “Performance Schema Connection Attribute Tables”</a>.
        </p><p>
          The <a class="link" href="performance-schema.html#session-connect-attrs-table" title="25.11.9.2 The session_connect_attrs Table"><code class="literal">session_connect_attrs</code></a> table
          contains connection attributes for all sessions. To see
          connection attributes only for sessions for your own account,
          look in the
          <a class="link" href="performance-schema.html#session-account-connect-attrs-table" title="25.11.9.1 The session_account_connect_attrs Table"><code class="literal">session_account_connect_attrs</code></a>
          table.
        </p><p>
          The <a class="link" href="performance-schema.html#session-connect-attrs-table" title="25.11.9.2 The session_connect_attrs Table"><code class="literal">session_connect_attrs</code></a> table
          contains these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">PROCESSLIST_ID</code>
            </p><p>
              The connection identifier for the session.
            </p></li><li class="listitem"><p>
              <code class="literal">ATTR_NAME</code>
            </p><p>
              The attribute name.
            </p></li><li class="listitem"><p>
              <code class="literal">ATTR_VALUE</code>
            </p><p>
              The attribute value.
            </p></li><li class="listitem"><p>
              <code class="literal">ORDINAL_POSITION</code>
            </p><p>
              The order in which the attribute was added to the set of
              connection attributes.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#session-connect-attrs-table" title="25.11.9.2 The session_connect_attrs Table"><code class="literal">session_connect_attrs</code></a>
          table.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-user-variable-tables"></a>25.11.10 Performance Schema User Variable Tables</h3>

</div>

</div>

</div>
<a class="indexterm" name="idm139684628377680"></a><a class="indexterm" name="idm139684628376176"></a><p>
        The Performance Schema provides a
        <a class="link" href="performance-schema.html#performance-schema-user-variable-tables" title="25.11.10 Performance Schema User Variable Tables"><code class="literal">user_variables_by_thread</code></a> table that
        exposes user-defined variables. These are variables defined
        within a specific session and include a <code class="literal">@</code>
        character preceding the name; see
        <a class="xref" href="language-structure.html#user-variables" title="9.4 User-Defined Variables">Section 9.4, “User-Defined Variables”</a>.
      </p><p>
        The <a class="link" href="performance-schema.html#performance-schema-user-variable-tables" title="25.11.10 Performance Schema User Variable Tables"><code class="literal">user_variables_by_thread</code></a> table
        contains these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">THREAD_ID</code>
          </p><p>
            The thread identifier of the session in which the variable
            is defined.
          </p></li><li class="listitem"><p>
            <code class="literal">VARIABLE_NAME</code>
          </p><p>
            The variable name, without the leading <code class="literal">@</code>
            character.
          </p></li><li class="listitem"><p>
            <code class="literal">VARIABLE_VALUE</code>
          </p><p>
            The variable value.
</p></li></ul>
</div>
<p>
        <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
        for the <a class="link" href="performance-schema.html#performance-schema-user-variable-tables" title="25.11.10 Performance Schema User Variable Tables"><code class="literal">user_variables_by_thread</code></a>
        table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-replication-tables"></a>25.11.11 Performance Schema Replication Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#replication-connection-configuration-table">25.11.11.1 The replication_connection_configuration Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#replication-connection-status-table">25.11.11.2 The replication_connection_status Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#replication-applier-configuration-table">25.11.11.3 The replication_applier_configuration Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#replication-applier-status-table">25.11.11.4 The replication_applier_status Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#replication-applier-status-by-coordinator-table">25.11.11.5 The replication_applier_status_by_coordinator Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#replication-applier-status-by-worker-table">25.11.11.6 The replication_applier_status_by_worker Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#replication-group-members-table">25.11.11.7 The replication_group_members Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#replication-group-member-stats-table">25.11.11.8 The replication_group_member_stats Table</a></span></dt></dl>
</div>
<p>
        The Performance Schema provides tables that expose replication
        information. This is similar to the information available from
        the <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a> statement,
        but representation in table form is more accessible and has
        usability benefits:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a> output is
            useful for visual inspection, but not so much for
            programmatic use. By contrast, using the Performance Schema
            tables, information about slave status can be searched using
            general <a class="link" href="sql-syntax.html#select" title="13.2.9 SELECT Syntax"><code class="literal">SELECT</code></a> queries,
            including complex <code class="literal">WHERE</code> conditions,
            joins, and so forth.
          </p></li><li class="listitem"><p>
            Query results can be saved in tables for further analysis,
            or assigned to variables and thus used in stored procedures.
          </p></li><li class="listitem"><p>
            The replication tables provide better diagnostic
            information. For multithreaded slave operation,
            <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a> reports all
            coordinator and worker thread errors using the
            <code class="literal">Last_SQL_Errno</code> and
            <code class="literal">Last_SQL_Error</code> fields, so only the most
            recent of those errors is visible and information can be
            lost. The replication tables store errors on a per-thread
            basis without loss of information.
          </p></li><li class="listitem"><p>
            The last seen transaction is visible in the replication
            tables on a per-worker basis. This is information not
            avilable from <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE
            STATUS</code></a>.
          </p></li><li class="listitem"><p>
            Developers familiar with the Performance Schema interface
            can extend the replication tables to provide additional
            information by adding rows to the tables.
</p></li></ul>
</div>
<h4><a name="idm139684628344144"></a>Replication Table Descriptions</h4>
<p>
        The Performance Schema provides the following
        replication-related tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Tables that contain information about the connection of the
            slave server to the master server:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                <a class="link" href="performance-schema.html#replication-connection-configuration-table" title="25.11.11.1 The replication_connection_configuration Table"><code class="literal">replication_connection_configuration</code></a>:
                Configuration parameters for connecting to the master
              </p></li><li class="listitem"><p>
                <a class="link" href="performance-schema.html#replication-connection-status-table" title="25.11.11.2 The replication_connection_status Table"><code class="literal">replication_connection_status</code></a>:
                Current status of the connection to the master
</p></li></ul>
</div>
</li><li class="listitem"><p>
            Tables that contain general (not thread-specific)
            information about the transaction applier:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                <a class="link" href="performance-schema.html#replication-applier-configuration-table" title="25.11.11.3 The replication_applier_configuration Table"><code class="literal">replication_applier_configuration</code></a>:
                Configuration parameters for the transaction applier on
                the slave.
              </p></li><li class="listitem"><p>
                <a class="link" href="performance-schema.html#replication-applier-status-table" title="25.11.11.4 The replication_applier_status Table"><code class="literal">replication_applier_status</code></a>:
                Current status of the transaction applier on the slave.
</p></li></ul>
</div>
</li><li class="listitem"><p>
            Tables that contain information about specific threads
            responsible for applying transactions received from the
            master:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                <a class="link" href="performance-schema.html#replication-applier-status-by-coordinator-table" title="25.11.11.5 The replication_applier_status_by_coordinator Table"><code class="literal">replication_applier_status_by_coordinator</code></a>:
                Status of the coordinator thread (empty unless the slave
                is multithreaded).
              </p></li><li class="listitem"><p>
                <a class="link" href="performance-schema.html#replication-applier-status-by-worker-table" title="25.11.11.6 The replication_applier_status_by_worker Table"><code class="literal">replication_applier_status_by_worker</code></a>:
                Status of the applier thread or worker threads if the
                slave is multithreaded.
</p></li></ul>
</div>
</li><li class="listitem"><p>
            Tables that contain information about replication group
            members:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                <a class="link" href="performance-schema.html#replication-group-members-table" title="25.11.11.7 The replication_group_members Table"><code class="literal">replication_group_members</code></a>:
                Provides network and status information for group
                members.
              </p></li><li class="listitem"><p>
                <a class="link" href="performance-schema.html#replication-group-member-stats-table" title="25.11.11.8 The replication_group_member_stats Table"><code class="literal">replication_group_member_stats</code></a>:
                Provides statistical information about group members and
                transaction in which they participate.
</p></li></ul>
</div>
</li></ul>
</div>
<p>
        The following sections describe each replication table in more
        detail, including the correspondence between the columns
        produced by <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a> and
        the replication table columns in which the same information
        appears.
      </p><p>
        The remainder of this introduction to the replication tables
        describes how the Performance Schema populates them and which
        fields from <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a> are
        not represented in the tables.
</p>
<h4><a name="idm139684628316416"></a>Replication Table Life Cycle</h4>
<p>
        The Performance Schema populates the replication tables as
        follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            Prior to execution of <a class="link" href="sql-syntax.html#change-master-to" title="13.4.2.1 CHANGE MASTER TO Syntax"><code class="literal">CHANGE MASTER
            TO</code></a>, the tables are empty.
          </p></li><li class="listitem"><p>
            After <a class="link" href="sql-syntax.html#change-master-to" title="13.4.2.1 CHANGE MASTER TO Syntax"><code class="literal">CHANGE MASTER TO</code></a>, the
            configuration parameters can be seen in the tables. At this
            time, there are no active slave threads, so the
            <code class="literal">THREAD_ID</code> columns are
            <code class="literal">NULL</code> and the
            <code class="literal">SERVICE_STATE</code> columns have a value of
            <code class="literal">OFF</code>.
          </p></li><li class="listitem"><p>
            After <a class="link" href="sql-syntax.html#start-slave" title="13.4.2.6 START SLAVE Syntax"><code class="literal">START SLAVE</code></a>,
            non-<code class="literal">NULL</code> <code class="literal">THREAD_ID</code>
            values can be seen. Threads that are idle or active have a
            <code class="literal">SERVICE_STATE</code> value of
            <code class="literal">ON</code>. The thread that connects to the
            master server has a value of <code class="literal">CONNECTING</code>
            while it establishes the connection, and
            <code class="literal">ON</code> thereafter as long as the connection
            lasts.
          </p></li><li class="listitem"><p>
            After <a class="link" href="sql-syntax.html#stop-slave" title="13.4.2.7 STOP SLAVE Syntax"><code class="literal">STOP SLAVE</code></a>, the
            <code class="literal">THREAD_ID</code> columns become
            <code class="literal">NULL</code> and the
            <code class="literal">SERVICE_STATE</code> columns for threads that no
            longer exist have a value of <code class="literal">OFF</code>.
          </p></li><li class="listitem"><p>
            The tables are preserved after <a class="link" href="sql-syntax.html#stop-slave" title="13.4.2.7 STOP SLAVE Syntax"><code class="literal">STOP
            SLAVE</code></a> or threads dying due to an error.
          </p></li><li class="listitem"><p>
            The
            <a class="link" href="performance-schema.html#replication-applier-status-by-worker-table" title="25.11.11.6 The replication_applier_status_by_worker Table"><code class="literal">replication_applier_status_by_worker</code></a>
            table is nonempty only when the slave is operating in
            multithreaded mode. That is, if the
            <a class="link" href="replication.html#sysvar_slave_parallel_workers"><code class="literal">slave_parallel_workers</code></a>
            system variable is greater than 0, this table is populated
            when <a class="link" href="sql-syntax.html#start-slave" title="13.4.2.6 START SLAVE Syntax"><code class="literal">START SLAVE</code></a> is executed,
            and the number of rows shows the number of workers.
</p></li></ul>
</div>
<h4><a name="idm139684628289216"></a>SHOW SLAVE STATUS Information Not In the Replication Tables</h4>
<p>
        The information in the Performance Schema replication tables
        differs somewhat from the information available from
        <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a> because the
        tables are oriented toward use of global transaction identifiers
        (GTIDs), not file names and positions, and they represent server
        UUID values, not server ID values. Due to these differences,
        several <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a> columns
        are not preserved in the Performance Schema replication tables,
        or are represented a different way:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            The following fields refer to file names and positions and
            are not preserved:
          </p><pre data-lang="none" class="programlisting">
Master_Log_File
Read_Master_Log_Pos
Relay_Log_File
Relay_Log_Pos
Relay_Master_Log_File
Exec_Master_Log_Pos
Until_Condition
Until_Log_File
Until_Log_Pos
</pre></li><li class="listitem"><p>
            The <code class="literal">Master_Info_File</code> field is not
            preserved. It refers to the <code class="filename">master.info</code>
            file, which has been superseded by crash-safe slave tables.
          </p></li><li class="listitem"><p>
            The following fields are based on
            <a class="link" href="server-administration.html#sysvar_server_id"><code class="literal">server_id</code></a>, not
            <a class="link" href="replication.html#sysvar_server_uuid"><code class="literal">server_uuid</code></a>, and are not
            preserved:
          </p><pre data-lang="none" class="programlisting">
Master_Server_Id
Replicate_Ignore_Server_Ids
</pre></li><li class="listitem"><p>
            The <code class="literal">Skip_Counter</code> field is based on event
            counts, not GTIDs, and is not preserved.
          </p></li><li class="listitem"><p>
            These error fields are aliases for
            <code class="literal">Last_SQL_Errno</code> and
            <code class="literal">Last_SQL_Error</code>, so they are not
            preserved:
          </p><pre data-lang="none" class="programlisting">
Last_Errno
Last_Error
</pre><p>
            In the Performance Schema, this error information is
            available in the <code class="literal">LAST_ERROR_NUMBER</code> and
            <code class="literal">LAST_ERROR_MESSAGE</code> columns of the
            <a class="link" href="performance-schema.html#replication-applier-status-by-coordinator-table" title="25.11.11.5 The replication_applier_status_by_coordinator Table"><code class="literal">replication_applier_status_by_coordinator</code></a>
            table (and
            <a class="link" href="performance-schema.html#replication-applier-status-by-worker-table" title="25.11.11.6 The replication_applier_status_by_worker Table"><code class="literal">replication_applier_status_by_worker</code></a>
            if the slave is multithreaded). Those tables provide more
            specific per-thread error information than is available from
            <code class="literal">Last_Errno</code> and
            <code class="literal">Last_Error</code>.
          </p></li><li class="listitem"><p>
            Fields that provide information about command-line filtering
            options is not preserved:
          </p><pre data-lang="none" class="programlisting">
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
</pre></li><li class="listitem"><p>
            The <code class="literal">Slave_IO_State</code> and
            <code class="literal">Slave_SQL_Running_State</code> fields are not
            preserved. If needed, these values can be obtained from the
            process list by using the <code class="literal">THREAD_ID</code>
            column of the appropriate replication table and joining it
            with the <code class="literal">ID</code> column in the
            <code class="literal">INFORMATION_SCHEMA</code>
            <a class="link" href="information-schema.html#processlist-table" title="24.18 The INFORMATION_SCHEMA PROCESSLIST Table"><code class="literal">PROCESSLIST</code></a> table to select the
            <code class="literal">STATE</code> column of the latter table.
          </p></li><li class="listitem"><p>
            The <code class="literal">Executed_Gtid_Set</code> field can show a
            large set with a great deal of text. Instead, the
            Performance Schema tables show GTIDs of transactions that
            are currently being applied by the slave. Alternatively, the
            set of executed GTIDs can be obtained from the value of the
            <a class="link" href="replication.html#sysvar_gtid_executed"><code class="literal">gtid_executed</code></a> system
            variable.
          </p></li><li class="listitem"><p>
            The <code class="literal">Seconds_Behind_Master</code> and
            <code class="literal">Relay_Log_Space</code> fields are in
            to-be-decided status and are not preserved.
</p></li></ul>
</div>
<h4><a name="idm139684628251136"></a>Status Variables Moved to Replication Tables</h4>
<p>
        As of MySQL version 5.7.5, the following status variables
        (previously monitored using <a class="link" href="sql-syntax.html#show-status" title="13.7.5.35 SHOW STATUS Syntax"><code class="literal">SHOW
        STATUS</code></a>) were moved to the Perfomance Schema
        replication tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="server-administration.html#statvar_Slave_retried_transactions"><code class="literal">Slave_retried_transactions</code></a>
          </p></li><li class="listitem"><p>
            <a class="link" href="server-administration.html#statvar_Slave_last_heartbeat"><code class="literal">Slave_last_heartbeat</code></a>
          </p></li><li class="listitem"><p>
            <a class="link" href="server-administration.html#statvar_Slave_received_heartbeats"><code class="literal">Slave_received_heartbeats</code></a>
          </p></li><li class="listitem"><p>
            <a class="link" href="server-administration.html#statvar_Slave_heartbeat_period"><code class="literal">Slave_heartbeat_period</code></a>
          </p></li><li class="listitem"><p>
            <a class="link" href="server-administration.html#statvar_Slave_running"><code class="literal">Slave_running</code></a>
</p></li></ul>
</div>
<p>
        These status variables are now only relevant when a single
        replication channel is being used because they
        <span class="emphasis"><em>only</em></span> report the status of the default
        replication channel. When multiple replication channels exist,
        use the Performance Schema replication tables described in this
        section, which report these variables for each existing
        replication channel.
</p>
<h4><a name="idm139684628236256"></a>Replication Channels</h4>
<p>
        The first column of the replication Performance Schema tables is
        <code class="literal">CHANNEL_NAME</code>. This enables the tables to be
        viewed per replication channel. In a non-multisource replication
        setup there is a single default replication channel. When you
        are using multiple replication channels on a slave, you can
        filter the tables per replication channel to monitor a specific
        replication channel. See <a class="xref" href="replication.html#replication-channels" title="16.2.3 Replication Channels">Section 16.2.3, “Replication Channels”</a>
        and <a class="xref" href="replication.html#replication-multi-source-monitoring" title="16.1.4.3 Multi-Source Replication Monitoring">Section 16.1.4.3, “Multi-Source Replication Monitoring”</a> for
        more information.
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="replication-connection-configuration-table"></a>25.11.11.1 The replication_connection_configuration Table</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm139684628231376"></a><a class="indexterm" name="idm139684628229872"></a><p>
          This table shows the configuration parameters used by the
          slave server for connecting to the master server. Parameters
          stored in the table can be changed at runtime with the
          <a class="link" href="sql-syntax.html#change-master-to" title="13.4.2.1 CHANGE MASTER TO Syntax"><code class="literal">CHANGE MASTER TO</code></a> statement, as
          indicated in the column descriptions.
        </p><p>
          Compared to the
          <a class="link" href="performance-schema.html#replication-connection-status-table" title="25.11.11.2 The replication_connection_status Table"><code class="literal">replication_connection_status</code></a>
          table,
          <a class="link" href="performance-schema.html#replication-connection-configuration-table" title="25.11.11.1 The replication_connection_configuration Table"><code class="literal">replication_connection_configuration</code></a>
          changes less frequently. It contains values that define how
          the slave connects to the master and that remain constant
          during the connection, whereas
          <a class="link" href="performance-schema.html#replication-connection-status-table" title="25.11.11.2 The replication_connection_status Table"><code class="literal">replication_connection_status</code></a>
          contains values that change during the connection.
        </p><p>
          The
          <a class="link" href="performance-schema.html#replication-connection-configuration-table" title="25.11.11.1 The replication_connection_configuration Table"><code class="literal">replication_connection_configuration</code></a>
          table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">CHANNEL_NAME</code>
            </p><p>
              The replication channel which this row is displaying.
              There is always a default replication channel, and more
              replication channels can be added. See
              <a class="xref" href="replication.html#replication-channels" title="16.2.3 Replication Channels">Section 16.2.3, “Replication Channels”</a> for more
              information.
            </p></li><li class="listitem"><p>
              <code class="literal">HOST</code>
            </p><p>
              The master host that the slave is connected to.
              (<code class="literal">CHANGE MASTER TO</code> option:
              <code class="literal">MASTER_HOST</code>)
            </p></li><li class="listitem"><p>
              <code class="literal">PORT</code>
            </p><p>
              The port used to connect to the master. (<code class="literal">CHANGE
              MASTER TO</code> option:
              <code class="literal">MASTER_PORT</code>)
            </p></li><li class="listitem"><p>
              <code class="literal">USER</code>
            </p><p>
              The user name of the account used to connect to the
              master. (<code class="literal">CHANGE MASTER TO</code> option:
              <code class="literal">MASTER_USER</code>)
            </p></li><li class="listitem"><p>
              <code class="literal">NETWORK_INTERFACE</code>
            </p><p>
              The network interface that the slave is bound to, if any.
              (<code class="literal">CHANGE MASTER TO</code> option:
              <code class="literal">MASTER_BIND</code>)
            </p></li><li class="listitem"><p>
              <code class="literal">AUTO_POSITION</code>
            </p><p>
              1 if autopositioning is in use; otherwise 0.
              (<code class="literal">CHANGE MASTER TO</code> option:
              <code class="literal">MASTER_AUTO_POSITION</code>)
            </p></li><li class="listitem"><p>
              <code class="literal">SSL_ALLOWED</code>,
              <code class="literal">SSL_CA_FILE</code>,
              <code class="literal">SSL_CA_PATH</code>,
              <code class="literal">SSL_CERTIFICATE</code>,
              <code class="literal">SSL_CIPHER</code>, <code class="literal">SSL_KEY</code>,
              <code class="literal">SSL_VERIFY_SERVER_CERTIFICATE</code>,
              <code class="literal">SSL_CRL_FILE</code>,
              <code class="literal">SSL_CRL_PATH</code>
            </p><p>
              These columns show the SSL parameters used by the slave to
              connect to the master, if any.
            </p><p>
              <code class="literal">SSL_ALLOWED</code> has these values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  <code class="literal">Yes</code> if an SSL connection to the
                  master is permitted
                </p></li><li class="listitem"><p>
                  <code class="literal">No</code> if an SSL connection to the
                  master is not permitted
                </p></li><li class="listitem"><p>
                  <code class="literal">Ignored</code> if an SSL connection is
                  permitted but the slave server does not have SSL
                  support enabled
</p></li></ul>
</div>
<p>
              <code class="literal">CHANGE MASTER TO</code> options for the other
              SSL columns: <code class="literal">MASTER_SSL_CA</code>,
              <code class="literal">MASTER_SSL_CAPATH</code>,
              <code class="literal">MASTER_SSL_CERT</code>,
              <code class="literal">MASTER_SSL_CIPHER</code>,
              <code class="literal">MASTER_SSL_CRL</code>,
              <code class="literal">MASTER_SSL_CRLPATH</code>,
              <code class="literal">MASTER_SSL_KEY</code>,
              <code class="literal">MASTER_SSL_VERIFY_SERVER_CERT</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">CONNECTION_RETRY_INTERVAL</code>
            </p><p>
              The number of seconds between connect retries.
              (<code class="literal">CHANGE MASTER TO</code> option:
              <code class="literal">MASTER_CONNECT_RETRY</code>)
            </p></li><li class="listitem"><p>
              <code class="literal">CONNECTION_RETRY_COUNT</code>
            </p><p>
              The number of times the slave can attempt to reconnect to
              the master in the event of a lost connection.
              (<code class="literal">CHANGE MASTER TO</code> option:
              <code class="literal">MASTER_RETRY_COUNT</code>)
            </p></li><li class="listitem"><p>
              <code class="literal">HEARTBEAT_INTERVAL</code>
            </p><p>
              The replication heartbeat interval on a slave, measured in
              seconds.
            </p></li><li class="listitem"><p>
              <code class="literal">TLS_VERSION</code>
            </p><p>
              The TLS version used on the master. For TLS version
              information, see
              <a class="xref" href="security.html#encrypted-connection-protocols-ciphers" title="6.4.6 Encrypted Connection Protocols and Ciphers">Section 6.4.6, “Encrypted Connection Protocols and Ciphers”</a>.
              This column was added in MySQL 5.7.10.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the
          <a class="link" href="performance-schema.html#replication-connection-configuration-table" title="25.11.11.1 The replication_connection_configuration Table"><code class="literal">replication_connection_configuration</code></a>
          table.
        </p><p>
          The following table shows the correspondence between
          <a class="link" href="performance-schema.html#replication-connection-configuration-table" title="25.11.11.1 The replication_connection_configuration Table"><code class="literal">replication_connection_configuration</code></a>
          columns and <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a>
          columns.
</p>
<div class="informaltable">
<table summary="Correspondence between replication_connection_configuration columns and SHOW SLAVE STATUS columns"><col width="60%"><col width="40%"><thead><tr>
              <th scope="col"><code class="literal">replication_connection_configuration</code> Column</th>
              <th scope="col"><code class="literal">SHOW SLAVE STATUS</code> Column</th>
            </tr></thead><tbody><tr>
              <td scope="row"><code class="literal">HOST</code></td>
              <td><code class="literal">Master_Host</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">PORT</code></td>
              <td><code class="literal">Master_Port</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">USER</code></td>
              <td><code class="literal">Master_User</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">NETWORK_INTERFACE</code></td>
              <td><code class="literal">Master_Bind</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">AUTO_POSITION</code></td>
              <td><code class="literal">Auto_Position</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">SSL_ALLOWED</code></td>
              <td><code class="literal">Master_SSL_Allowed</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">SSL_CA_FILE</code></td>
              <td><code class="literal">Master_SSL_CA_File</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">SSL_CA_PATH</code></td>
              <td><code class="literal">Master_SSL_CA_Path</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">SSL_CERTIFICATE</code></td>
              <td><code class="literal">Master_SSL_Cert</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">SSL_CIPHER</code></td>
              <td><code class="literal">Master_SSL_Cipher</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">SSL_KEY</code></td>
              <td><code class="literal">Master_SSL_Key</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">SSL_VERIFY_SERVER_CERTIFICATE</code></td>
              <td><code class="literal">Master_SSL_Verify_Server_Cert</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">SSL_CRL_FILE</code></td>
              <td><code class="literal">Master_SSL_Crl</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">SSL_CRL_PATH</code></td>
              <td><code class="literal">Master_SSL_Crlpath</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">CONNECTION_RETRY_INTERVAL</code></td>
              <td><code class="literal">Connect_Retry</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">CONNECTION_RETRY_COUNT</code></td>
              <td><code class="literal">Master_Retry_Count</code></td>
</tr></tbody></table>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="replication-connection-status-table"></a>25.11.11.2 The replication_connection_status Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684628102272"></a><a class="indexterm" name="idm139684628100768"></a><p>
          This table shows the current status of the I/O thread that
          handles the slave server connection to the master server.
        </p><p>
          Compared to the
          <a class="link" href="performance-schema.html#replication-connection-configuration-table" title="25.11.11.1 The replication_connection_configuration Table"><code class="literal">replication_connection_configuration</code></a>
          table,
          <a class="link" href="performance-schema.html#replication-connection-status-table" title="25.11.11.2 The replication_connection_status Table"><code class="literal">replication_connection_status</code></a>
          changes more frequently. It contains values that change during
          the connection, whereas
          <a class="link" href="performance-schema.html#replication-connection-configuration-table" title="25.11.11.1 The replication_connection_configuration Table"><code class="literal">replication_connection_configuration</code></a>
          contains values which define how the slave connects to the
          master and that remain constant during the connection.
        </p><p>
          The <a class="link" href="performance-schema.html#replication-connection-status-table" title="25.11.11.2 The replication_connection_status Table"><code class="literal">replication_connection_status</code></a>
          table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">CHANNEL_NAME</code>
            </p><p>
              The replication channel which this row is displaying.
              There is always a default replication channel, and more
              replication channels can be added. See
              <a class="xref" href="replication.html#replication-channels" title="16.2.3 Replication Channels">Section 16.2.3, “Replication Channels”</a> for more
              information.
            </p></li><li class="listitem"><p>
              <code class="literal">GROUP_NAME</code>
            </p><p>
              If this server is a member of a group, shows the name of
              the group the server belongs to.
            </p></li><li class="listitem"><p>
              <code class="literal">SOURCE_UUID</code>
            </p><p>
              The <a class="link" href="replication.html#sysvar_server_uuid"><code class="literal">server_uuid</code></a> value
              from the master.
            </p></li><li class="listitem"><p>
              <code class="literal">THREAD_ID</code>
            </p><p>
              The I/O thread ID.
            </p></li><li class="listitem"><p>
              <code class="literal">SERVICE_STATE</code>
            </p><p>
              <code class="literal">ON</code> (thread exists and is active or
              idle), <code class="literal">OFF</code> (thread no longer exists),
              or <code class="literal">CONNECTING</code> (thread exists and is
              connecting to the master).
            </p></li><li class="listitem"><p>
              <code class="literal">RECEIVED_TRANSACTION_SET</code>
            </p><p>
              The set of global transaction IDs (GTIDs) corresponding to
              all transactions received by this slave. Empty if GTIDs
              are not in use. See
              <a class="xref" href="replication.html#replication-gtids-concepts-gtid-sets" title="GTID Sets">GTID Sets</a> for
              more information.
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_ERROR_NUMBER</code>,
              <code class="literal">LAST_ERROR_MESSAGE</code>
            </p><p>
              The error number and error message of the most recent
              error that caused the I/O thread to stop. An error number
              of 0 and message of the empty string mean <span class="quote">“<span class="quote">no
              error.</span>”</span> If the
              <code class="literal">LAST_ERROR_MESSAGE</code> value is not empty,
              the error values also appear in the slave's error log.
            </p><p>
              Issuing <a class="link" href="sql-syntax.html#reset-master" title="13.4.1.2 RESET MASTER Syntax"><code class="literal">RESET MASTER</code></a> or
              <a class="link" href="sql-syntax.html#reset-slave" title="13.4.2.4 RESET SLAVE Syntax"><code class="literal">RESET SLAVE</code></a> resets the
              values shown in these columns.
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_ERROR_TIMESTAMP</code>
            </p><p>
              A timestamp in <code class="literal">YYMMDD HH:MM:SS</code> format
              that shows when the most recent I/O error took place.
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_HEARTBEAT_TIMESTAMP</code>
            </p><p>
              A timestamp in <code class="literal">YYMMDD HH:MM:SS</code> format
              that shows when the most recent heartbeat signal was
              received by a replication slave.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_RECEIVED_HEARTBEATS</code>
            </p><p>
              The total number of heartbeat signals that a replication
              slave received since the last time it was restarted or
              reset, or a <code class="literal">CHANGE MASTER TO</code> statement
              was issued.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the
          <a class="link" href="performance-schema.html#replication-connection-status-table" title="25.11.11.2 The replication_connection_status Table"><code class="literal">replication_connection_status</code></a>
          table.
        </p><p>
          The following table shows the correspondence between
          <a class="link" href="performance-schema.html#replication-connection-status-table" title="25.11.11.2 The replication_connection_status Table"><code class="literal">replication_connection_status</code></a>
          columns and <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a>
          columns.
</p>
<div class="informaltable">
<table summary="Correspondence between replication_connection_status columns and SHOW SLAVE STATUS columns"><col width="60%"><col width="40%"><thead><tr>
              <th scope="col"><code class="literal">replication_connection_status</code> Column</th>
              <th scope="col"><code class="literal">SHOW SLAVE STATUS</code> Column</th>
            </tr></thead><tbody><tr>
              <td scope="row"><code class="literal">SOURCE_UUID</code></td>
              <td><code class="literal">Master_UUID</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">THREAD_ID</code></td>
              <td>None</td>
            </tr><tr>
              <td scope="row"><code class="literal">SERVICE_STATE</code></td>
              <td><code class="literal">Slave_IO_Running</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">RECEIVED_TRANSACTION_SET</code></td>
              <td><code class="literal">Retrieved_Gtid_Set</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_ERROR_NUMBER</code></td>
              <td><code class="literal">Last_IO_Errno</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_ERROR_MESSAGE</code></td>
              <td><code class="literal">Last_IO_Error</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_ERROR_TIMESTAMP</code></td>
              <td><code class="literal">Last_IO_Error_Timestamp</code></td>
</tr></tbody></table>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="replication-applier-configuration-table"></a>25.11.11.3 The replication_applier_configuration Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684628024032"></a><a class="indexterm" name="idm139684628022576"></a><p>
          This table shows the configuration parameters that affect
          transactions applied by the slave server. Parameters stored in
          the table can be changed at runtime with the
          <a class="link" href="sql-syntax.html#change-master-to" title="13.4.2.1 CHANGE MASTER TO Syntax"><code class="literal">CHANGE MASTER TO</code></a> statement, as
          indicated in the column descriptions.
        </p><p>
          The
          <a class="link" href="performance-schema.html#replication-applier-configuration-table" title="25.11.11.3 The replication_applier_configuration Table"><code class="literal">replication_applier_configuration</code></a>
          table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">CHANNEL_NAME</code>
            </p><p>
              The replication channel which this row is displaying.
              There is always a default replication channel, and more
              replication channels can be added. See
              <a class="xref" href="replication.html#replication-channels" title="16.2.3 Replication Channels">Section 16.2.3, “Replication Channels”</a> for more
              information.
            </p></li><li class="listitem"><p>
              <code class="literal">DESIRED_DELAY</code>
            </p><p>
              The number of seconds that the slave must lag the master.
              (<code class="literal">CHANGE MASTER TO</code> option:
              <code class="literal">MASTER_DELAY</code>)
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the
          <a class="link" href="performance-schema.html#replication-applier-configuration-table" title="25.11.11.3 The replication_applier_configuration Table"><code class="literal">replication_applier_configuration</code></a>
          table.
        </p><p>
          The following table shows the correspondence between
          <a class="link" href="performance-schema.html#replication-applier-configuration-table" title="25.11.11.3 The replication_applier_configuration Table"><code class="literal">replication_applier_configuration
          </code></a> columns and <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE
          STATUS</code></a> columns.
</p>
<div class="informaltable">
<table summary="Correspondence between replication_applier_configuration columns and SHOW SLAVE STATUS columns"><col width="60%"><col width="40%"><thead><tr>
              <th scope="col"><code class="literal">replication_applier_configuration</code> Column</th>
              <th scope="col"><code class="literal">SHOW SLAVE STATUS</code> Column</th>
            </tr></thead><tbody><tr>
              <td scope="row"><code class="literal">DESIRED_DELAY</code></td>
              <td><code class="literal">SQL_Delay</code></td>
</tr></tbody></table>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="replication-applier-status-table"></a>25.11.11.4 The replication_applier_status Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684627993664"></a><a class="indexterm" name="idm139684627992160"></a><p>
          This table shows the current general transaction execution
          status on the slave server. The table provides information
          about general aspects of transaction applier status that are
          not specific to any thread involved. Thread-specific status
          information is available in the
          <a class="link" href="performance-schema.html#replication-applier-status-by-coordinator-table" title="25.11.11.5 The replication_applier_status_by_coordinator Table"><code class="literal">replication_applier_status_by_coordinator</code></a>
          table (and
          <a class="link" href="performance-schema.html#replication-applier-status-by-worker-table" title="25.11.11.6 The replication_applier_status_by_worker Table"><code class="literal">replication_applier_status_by_worker</code></a>
          if the slave is multithreaded).
        </p><p>
          The <a class="link" href="performance-schema.html#replication-applier-status-table" title="25.11.11.4 The replication_applier_status Table"><code class="literal">replication_applier_status</code></a>
          table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">CHANNEL_NAME</code>
            </p><p>
              The replication channel which this row is displaying.
              There is always a default replication channel, and more
              replication channels can be added. See
              <a class="xref" href="replication.html#replication-channels" title="16.2.3 Replication Channels">Section 16.2.3, “Replication Channels”</a> for more
              information.
            </p></li><li class="listitem"><p>
              <code class="literal">SERVICE_STATE</code>
            </p><p>
              Shows <code class="literal">ON</code> when the replication channel's
              applier threads are active or idle, <code class="literal">OFF</code>
              means that the applier threads are not active.
            </p></li><li class="listitem"><p>
              <code class="literal">REMAINING_DELAY</code>
            </p><p>
              If the slave is waiting for
              <code class="literal">DESIRED_DELAY</code> seconds to pass since the
              master applied an event, this field contains the number of
              delay seconds remaining. At other times, this field is
              <code class="literal">NULL</code>. (The
              <code class="literal">DESIRED_DELAY</code> value is stored in the
              <a class="link" href="performance-schema.html#replication-applier-configuration-table" title="25.11.11.3 The replication_applier_configuration Table"><code class="literal">replication_applier_configuration</code></a>
              table.)
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_TRANSACTIONS_RETRIES</code>
            </p><p>
              Shows the number of retries that were made because the
              slave SQL thread failed to apply a transaction. The
              maximum number of retries for a given transaction is set
              by the
              <a class="link" href="replication.html#sysvar_slave_transaction_retries"><code class="literal">slave_transaction_retries</code></a>
              system variable.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the
          <a class="link" href="performance-schema.html#replication-applier-status-table" title="25.11.11.4 The replication_applier_status Table"><code class="literal">replication_applier_status</code></a> table.
        </p><p>
          The following table shows the correspondence between
          <a class="link" href="performance-schema.html#replication-applier-status-table" title="25.11.11.4 The replication_applier_status Table"><code class="literal">replication_applier_status</code></a>
          columns and <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a>
          columns.
</p>
<div class="informaltable">
<table summary="Correspondence between replication_applier_status columns and SHOW SLAVE STATUS columns"><col width="60%"><col width="40%"><thead><tr>
              <th scope="col"><code class="literal">replication_applier_status</code> Column</th>
              <th scope="col"><code class="literal">SHOW SLAVE STATUS</code> Column</th>
            </tr></thead><tbody><tr>
              <td scope="row"><code class="literal">SERVICE_STATE</code></td>
              <td>None</td>
            </tr><tr>
              <td scope="row"><code class="literal">REMAINING_DELAY</code></td>
              <td><code class="literal">SQL_Remaining_Delay</code></td>
</tr></tbody></table>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="replication-applier-status-by-coordinator-table"></a>25.11.11.5 The replication_applier_status_by_coordinator Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684627949616"></a><a class="indexterm" name="idm139684627948096"></a><p>
          For a multithreaded slave, the slave uses multiple worker
          threads and a coordinator thread to manage them, and this
          table shows the status of the coordinator thread. For a
          single-threaded slave, this table is empty. For a
          multithreaded slave, the
          <a class="link" href="performance-schema.html#replication-applier-status-by-worker-table" title="25.11.11.6 The replication_applier_status_by_worker Table"><code class="literal">replication_applier_status_by_worker</code></a>
          table shows the status of the worker threads.
        </p><p>
          The
          <a class="link" href="performance-schema.html#replication-applier-status-by-coordinator-table" title="25.11.11.5 The replication_applier_status_by_coordinator Table"><code class="literal">replication_applier_status_by_coordinator</code></a>
          table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">CHANNEL_NAME</code>
            </p><p>
              The replication channel which this row is displaying.
              There is always a default replication channel, and more
              replication channels can be added. See
              <a class="xref" href="replication.html#replication-channels" title="16.2.3 Replication Channels">Section 16.2.3, “Replication Channels”</a> for more
              information.
            </p></li><li class="listitem"><p>
              <code class="literal">THREAD_ID</code>
            </p><p>
              The SQL/coordinator thread ID.
            </p></li><li class="listitem"><p>
              <code class="literal">SERVICE_STATE</code>
            </p><p>
              <code class="literal">ON</code> (thread exists and is active or
              idle) or <code class="literal">OFF</code> (thread no longer exists).
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_ERROR_NUMBER</code>,
              <code class="literal">LAST_ERROR_MESSAGE</code>
            </p><p>
              The error number and error message of the most recent
              error that caused the SQL/coordinator thread to stop. An
              error number of 0 and message which is an empty string
              means <span class="quote">“<span class="quote">no error</span>”</span>. If the
              <code class="literal">LAST_ERROR_MESSAGE</code> value is not empty,
              the error values also appear in the slave's error log.
            </p><p>
              Issuing <a class="link" href="sql-syntax.html#reset-master" title="13.4.1.2 RESET MASTER Syntax"><code class="literal">RESET MASTER</code></a> or
              <a class="link" href="sql-syntax.html#reset-slave" title="13.4.2.4 RESET SLAVE Syntax"><code class="literal">RESET SLAVE</code></a> resets the
              values shown in these columns.
            </p><p>
              All error codes and messages displayed in the
              <code class="literal">LAST_ERROR_NUMBER</code> and
              <code class="literal">LAST_ERROR_MESSAGE</code> columns correspond
              to error values listed in
              <a class="xref" href="error-handling.html#error-messages-server" title="B.3 Server Error Codes and Messages">Section B.3, “Server Error Codes and Messages”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_ERROR_TIMESTAMP</code>
            </p><p>
              A timestamp in <code class="literal">YYMMDD HH:MM:SS</code> format
              that shows when the most recent SQL/coordinator error
              occurred.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the
          <a class="link" href="performance-schema.html#replication-applier-status-by-coordinator-table" title="25.11.11.5 The replication_applier_status_by_coordinator Table"><code class="literal">replication_applier_status_by_coordinator</code></a>
          table.
        </p><p>
          The following table shows the correspondence between
          <a class="link" href="performance-schema.html#replication-applier-status-by-coordinator-table" title="25.11.11.5 The replication_applier_status_by_coordinator Table"><code class="literal">replication_applier_status_by_coordinator</code></a>
          columns and <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a>
          columns.
</p>
<div class="informaltable">
<table summary="Correspondence between replication_applier_status_by_coordinator columns and SHOW SLAVE STATUS columns"><col width="60%"><col width="40%"><thead><tr>
              <th scope="col"><code class="literal">replication_applier_status_by_coordinator</code> Column</th>
              <th scope="col"><code class="literal">SHOW SLAVE STATUS</code> Column</th>
            </tr></thead><tbody><tr>
              <td scope="row"><code class="literal">THREAD_ID</code></td>
              <td>None</td>
            </tr><tr>
              <td scope="row"><code class="literal">SERVICE_STATE</code></td>
              <td><code class="literal">Slave_SQL_Running</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_ERROR_NUMBER</code></td>
              <td><code class="literal">Last_SQL_Errno</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_ERROR_MESSAGE</code></td>
              <td><code class="literal">Last_SQL_Error</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_ERROR_TIMESTAMP</code></td>
              <td><code class="literal">Last_SQL_Error_Timestamp</code></td>
</tr></tbody></table>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="replication-applier-status-by-worker-table"></a>25.11.11.6 The replication_applier_status_by_worker Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684627892160"></a><a class="indexterm" name="idm139684627890656"></a><p>
          If the slave is not multithreaded, this table shows the status
          of the applier thread. Otherwise, the slave uses multiple
          worker threads and a coordinator thread to manage them, and
          this table shows the status of the worker threads. For a
          multithreaded slave, the
          <a class="link" href="performance-schema.html#replication-applier-status-by-coordinator-table" title="25.11.11.5 The replication_applier_status_by_coordinator Table"><code class="literal">replication_applier_status_by_coordinator</code></a>
          table shows the status of the coordinator thread.
        </p><p>
          The <code class="literal">replication_applier_status_by_worker</code>
          table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">CHANNEL_NAME</code>
            </p><p>
              The replication channel which this row is displaying.
              There is always a default replication channel, and more
              replication channels can be added. See
              <a class="xref" href="replication.html#replication-channels" title="16.2.3 Replication Channels">Section 16.2.3, “Replication Channels”</a> for more
              information.
            </p></li><li class="listitem"><p>
              <code class="literal">WORKER_ID</code>
            </p><p>
              The worker identifier (same value as the
              <code class="literal">id</code> column in the
              <code class="literal">mysql.slave_worker_info</code> table). After
              <a class="link" href="sql-syntax.html#stop-slave" title="13.4.2.7 STOP SLAVE Syntax"><code class="literal">STOP SLAVE</code></a>, the
              <code class="literal">THREAD_ID</code> column becomes
              <code class="literal">NULL</code>, but the
              <code class="literal">WORKER_ID</code> value is preserved.
            </p></li><li class="listitem"><p>
              <code class="literal">THREAD_ID</code>
            </p><p>
              The worker thread identifier.
            </p></li><li class="listitem"><p>
              <code class="literal">SERVICE_STATE</code>
            </p><p>
              <code class="literal">ON</code> (thread exists and is active or
              idle) or <code class="literal">OFF</code> (thread no longer exists).
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_SEEN_TRANSACTION</code>
            </p><p>
              The transaction that the worker has last seen. The worker
              has not necessarily applied this transaction because it
              could still be in the process of doing so.
            </p><p>
              If the <a class="link" href="replication.html#sysvar_gtid_mode"><code class="literal">gtid_mode</code></a> system
              variable value is <code class="literal">OFF</code>, this column is
              <code class="literal">ANONYMOUS</code>, indicating that transactions
              do not have global transaction identifiers (GTIDs) and are
              identified by file and position only.
            </p><p>
              If <a class="link" href="replication.html#sysvar_gtid_mode"><code class="literal">gtid_mode</code></a> is
              <code class="literal">ON</code>, the column value is defined as
              follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  If no transaction has executed, the column is empty.
                </p></li><li class="listitem"><p>
                  When a transaction has executed, the column is set
                  from <a class="link" href="replication.html#sysvar_gtid_next"><code class="literal">gtid_next</code></a> as
                  soon as <a class="link" href="replication.html#sysvar_gtid_next"><code class="literal">gtid_next</code></a> is
                  set. From this moment, the column always shows a GTID.
                </p></li><li class="listitem"><p>
                  The GTID is preserved until the next transaction is
                  executed. If an error occurs, the column value is the
                  GTID of the transaction being executed by the worker
                  when the error occurred. The following statement shows
                  whether or not that transaction has been committed:
                </p><pre data-lang="sql" class="programlisting">
mysql&gt; SELECT GTID_SUBSET(LAST_SEEN_TRANSACTION, @@GLOBAL.GTID_EXECUTED)
    -&gt;     FROM PERFORMANCE_SCHEMA.REPLICATION_EXECUTE_STATUS_BY_WORKER;</pre><p>
                  If the statement returns zero, the transaction has not
                  yet been committed, either because it is still being
                  processed, or because the worker thread was stopped
                  while it was being processed. If the statement returns
                  nonzero, the transaction has been committed.
</p></li></ul>
</div>
</li><li class="listitem"><p>
              <code class="literal">LAST_ERROR_NUMBER</code>,
              <code class="literal">LAST_ERROR_MESSAGE</code>
            </p><p>
              The error number and error message of the most recent
              error that caused the worker thread to stop. An error
              number of 0 and message of the empty string mean <span class="quote">“<span class="quote">no
              error</span>”</span>. If the
              <code class="literal">LAST_ERROR_MESSAGE</code> value is not empty,
              the error values also appear in the slave's error log.
            </p><p>
              Issuing <a class="link" href="sql-syntax.html#reset-master" title="13.4.1.2 RESET MASTER Syntax"><code class="literal">RESET MASTER</code></a> or
              <a class="link" href="sql-syntax.html#reset-slave" title="13.4.2.4 RESET SLAVE Syntax"><code class="literal">RESET SLAVE</code></a> resets the
              values shown in these columns.
            </p><p>
              All error codes and messages displayed in the
              <code class="literal">LAST_ERROR_NUMBER</code> and
              <code class="literal">LAST_ERROR_MESSAGE</code> columns correspond
              to error values listed in
              <a class="xref" href="error-handling.html#error-messages-server" title="B.3 Server Error Codes and Messages">Section B.3, “Server Error Codes and Messages”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_ERROR_TIMESTAMP</code>
            </p><p>
              A timestamp in <code class="literal">YYMMDD HH:MM:SS</code> format
              that shows when the most recent worker error occurred.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the
          <a class="link" href="performance-schema.html#replication-applier-status-by-worker-table" title="25.11.11.6 The replication_applier_status_by_worker Table"><code class="literal">replication_applier_status_by_worker</code></a>
          table.
        </p><p>
          The following table shows the correspondence between
          <code class="literal">replication_applier_status_by_worker</code>
          columns and <a class="link" href="sql-syntax.html#show-slave-status" title="13.7.5.34 SHOW SLAVE STATUS Syntax"><code class="literal">SHOW SLAVE STATUS</code></a>
          columns.
</p>
<div class="informaltable">
<table summary="Correspondence between replication_applier_status_by_worker columns and SHOW SLAVE STATUS columns"><col width="60%"><col width="40%"><thead><tr>
              <th scope="col"><code class="literal">replication_applier_status_by_worker</code> Column</th>
              <th scope="col"><code class="literal">SHOW SLAVE STATUS</code> Column</th>
            </tr></thead><tbody><tr>
              <td scope="row"><code class="literal">WORKER_ID</code></td>
              <td>None</td>
            </tr><tr>
              <td scope="row"><code class="literal">THREAD_ID</code></td>
              <td>None</td>
            </tr><tr>
              <td scope="row"><code class="literal">SERVICE_STATE</code></td>
              <td>None</td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_SEEN_TRANSACTION</code></td>
              <td>None</td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_ERROR_NUMBER</code></td>
              <td><code class="literal">Last_SQL_Errno</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_ERROR_MESSAGE</code></td>
              <td><code class="literal">Last_SQL_Error</code></td>
            </tr><tr>
              <td scope="row"><code class="literal">LAST_ERROR_TIMESTAMP</code></td>
              <td><code class="literal">Last_SQL_Error_Timestamp</code></td>
</tr></tbody></table>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="replication-group-members-table"></a>25.11.11.7 The replication_group_members Table</h4>

</div>

</div>

</div>
<p>
          This table shows network and status information for
          replication group members. The network addresses shown are the
          addresses used to connect clients to the group, and should not
          be confused with the member's internal group communication
          address specified by
          <a class="link" href="group-replication.html#sysvar_group_replication_local_address"><code class="literal">group_replication_local_address</code></a>.
        </p><p>
          The <code class="literal">replication_group_members</code> table has the
          following columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">CHANNEL_NAME</code>
            </p><p>
              Name of the Group Replication channel.
            </p></li><li class="listitem"><p>
              <code class="literal">MEMBER_ID</code>
            </p><p>
              Identifier for this member; the same as the server UUID.
            </p></li><li class="listitem"><p>
              <code class="literal">MEMBER_HOST</code>
            </p><p>
              Network address of this member (host name or IP address).
              Retrieved from the member's
              <a class="link" href="server-administration.html#sysvar_hostname"><code class="literal">hostname</code></a> variable.
            </p></li><li class="listitem"><p>
              <code class="literal">MEMBER_PORT</code>
            </p><p>
              Port on which the server is listening. Retrieved from the
              member's <a class="link" href="server-administration.html#sysvar_port"><code class="literal">port</code></a> variable.
            </p></li><li class="listitem"><p>
              <code class="literal">MEMBER_STATE</code>
            </p><p>
              Current state of this member; can be any one of the
              following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  <code class="literal">OFFLINE</code>: The Group Replication
                  plugin is installed but has not been started.
                </p></li><li class="listitem"><p>
                  <code class="literal">RECOVERING</code>: The server has joined a
                  group from which it is retrieving data.
                </p></li><li class="listitem"><p>
                  <code class="literal">ONLINE</code>: The member is in a fully
                  functioning state.
</p></li></ul>
</div>
</li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#replication-group-members-table" title="25.11.11.7 The replication_group_members Table"><code class="literal">replication_group_members</code></a>
          table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="replication-group-member-stats-table"></a>25.11.11.8 The replication_group_member_stats Table</h4>

</div>

</div>

</div>
<p>
          This table shows statistical information for MySQL Group
          Replication members. It is populated only when Group
          Replication is running.
        </p><p>
          The <code class="literal">replication_group_member_stats</code> table
          has the following columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">CHANNEL_NAME</code>
            </p><p>
              Name of the Group Replication channel.
            </p></li><li class="listitem"><p>
              <code class="literal">VIEW_ID</code>
            </p><p>
              Current view identifier for this group.
            </p></li><li class="listitem"><p>
              <code class="literal">MEMBER_ID</code>
            </p><p>
              Identifier for this member; same as the server UUID.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_TRANSACTIONS_IN_QUEUE</code>
            </p><p>
              Number of transactions pending certification.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_TRANSACTIONS_CHECKED</code>
            </p><p>
              Number of transactions already certified by this member.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_CONFLICTS_DETECTED</code>
            </p><p>
              Number of transactions that were negatively certified.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_TRANSACTIONS_ROWS_VALIDATING</code>
            </p><p>
              Number of transaction rows available which could be used
              for certification, but which have not been garbage
              collected.
            </p></li><li class="listitem"><p>
              <code class="literal">TRANSACTIONS_COMMITTED_ALL_MEMBERS</code>
            </p><p>
              Set of stable group transactions.
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_CONFLICT_FREE_TRANSACTION</code>
            </p><p>
              Latest transaction certified without conflicts.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the
          <a class="link" href="performance-schema.html#replication-group-member-stats-table" title="25.11.11.8 The replication_group_member_stats Table"><code class="literal">replication_group_member_stats</code></a>
          table.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-lock-tables"></a>25.11.12 Performance Schema Lock Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#metadata-locks-table">25.11.12.1 The metadata_locks Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#table-handles-table">25.11.12.2 The table_handles Table</a></span></dt></dl>
</div>
<p>
        The Performance Schema exposes lock information through these
        tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#metadata-locks-table" title="25.11.12.1 The metadata_locks Table"><code class="literal">metadata_locks</code></a>: Metadata locks
            held and requested
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#table-handles-table" title="25.11.12.2 The table_handles Table"><code class="literal">table_handles</code></a>: Table locks held
            and requested
</p></li></ul>
</div>
<p>
        The following sections describe these tables in more detail.
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="metadata-locks-table"></a>25.11.12.1 The metadata_locks Table</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm139684627752416"></a><a class="indexterm" name="idm139684627750960"></a><p>
          The Performance Schema exposes metadata lock information
          through the <a class="link" href="performance-schema.html#metadata-locks-table" title="25.11.12.1 The metadata_locks Table"><code class="literal">metadata_locks</code></a> table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Locks that have been granted (shows which sessions own
              which current metadata locks)
            </p></li><li class="listitem"><p>
              Locks that have been requested but not yet granted (shows
              which sessions are waiting for which metadata locks).
            </p></li><li class="listitem"><p>
              Lock requests that have been killed by the deadlock
              detector or timed out and are waiting for the requesting
              session's lock request to be discarded
</p></li></ul>
</div>
<p>
          This information enables you to understand metadata lock
          dependencies between sessions. You can see not only which lock
          a session is waiting for, but which session currently holds
          that lock.
        </p><p>
          The <a class="link" href="performance-schema.html#metadata-locks-table" title="25.11.12.1 The metadata_locks Table"><code class="literal">metadata_locks</code></a> table is read
          only and cannot be updated. It is autosized by default; to
          configure the table size, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_metadata_locks"><code class="literal">performance_schema_max_metadata_locks</code></a>
          system variable at server startup.
        </p><p>
          Metadata lock instrumentation uses the
          <code class="literal">wait/lock/metadata/sql/mdl</code> instrument,
          which is disabled by default.
        </p><p>
          To control metadata lock instrumention state at server
          startup, use lines like these in your
          <code class="filename">my.cnf</code> file:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Enable:
            </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='wait/lock/metadata/sql/mdl=ON'
</pre></li><li class="listitem"><p>
              Disable:
            </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='wait/lock/metadata/sql/mdl=OFF'
</pre></li></ul>
</div>
<p>
          To control metadata lock instrumention state at runtime,
          update the <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a>
          table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Enable:
            </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'YES', TIMED = 'YES'
WHERE NAME = 'wait/lock/metadata/sql/mdl';
</pre></li><li class="listitem"><p>
              Disable:
            </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'NO', TIMED = 'NO'
WHERE NAME = 'wait/lock/metadata/sql/mdl';
</pre></li></ul>
</div>
<p>
          The Performance Schema maintains
          <a class="link" href="performance-schema.html#metadata-locks-table" title="25.11.12.1 The metadata_locks Table"><code class="literal">metadata_locks</code></a> table content as
          follows, using the <code class="literal">LOCK_STATUS</code> column to
          indicate the status of each lock:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              When a metadata lock is requested and obtained
              immediately, a row with a status of
              <code class="literal">GRANTED</code> is inserted.
            </p></li><li class="listitem"><p>
              When a metadata lock is requested and not obtained
              immediately, a row with a status of
              <code class="literal">PENDING</code> is inserted.
            </p></li><li class="listitem"><p>
              When a metadata lock previously requested is granted, its
              row status is updated to <code class="literal">GRANTED</code>.
            </p></li><li class="listitem"><p>
              When a metadata lock is released, its row is deleted.
            </p></li><li class="listitem"><p>
              When a pending lock request is canceled by the deadlock
              detector to break a deadlock
              (<a class="link" href="error-handling.html#error_er_lock_deadlock"><code class="literal">ER_LOCK_DEADLOCK</code></a>), its
              row status is updated from <code class="literal">PENDING</code> to
              <code class="literal">VICTIM</code>.
            </p></li><li class="listitem"><p>
              When a pending lock request times out
              (<a class="link" href="error-handling.html#error_er_lock_wait_timeout"><code class="literal">ER_LOCK_WAIT_TIMEOUT</code></a>),
              its row status is updated from <code class="literal">PENDING</code>
              to <code class="literal">TIMEOUT</code>.
            </p></li><li class="listitem"><p>
              When granted lock or pending lock request is killed, its
              row status is updated from <code class="literal">GRANTED</code> or
              <code class="literal">PENDING</code> to <code class="literal">KILLED</code>.
            </p></li><li class="listitem"><p>
              The <code class="literal">VICTIM</code>, <code class="literal">TIMEOUT</code>,
              and <code class="literal">KILLED</code> status values are brief and
              signify that the lock row is about to be deleted.
            </p></li><li class="listitem"><p>
              The <code class="literal">PRE_ACQUIRE_NOTIFY</code> and
              <code class="literal">POST_RELEASE_NOTIFY</code> status values are
              brief and signify that the metadata locking subsubsystem
              is notifying interested storage engines while entering
              lock acquisition or leaving lock release operations. These
              status values were added in MySQL 5.7.11.
</p></li></ul>
</div>
<p>
          The <a class="link" href="performance-schema.html#metadata-locks-table" title="25.11.12.1 The metadata_locks Table"><code class="literal">metadata_locks</code></a> table has
          these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">OBJECT_TYPE</code>
            </p><p>
              The type of lock used in the metadata lock subsystem: The
              value is one of <code class="literal">GLOBAL</code>,
              <code class="literal">SCHEMA</code>, <code class="literal">TABLE</code>,
              <code class="literal">FUNCTION</code>, <code class="literal">PROCEDURE</code>,
              <code class="literal">TRIGGER</code> (currently unused),
              <code class="literal">EVENT</code>, <code class="literal">COMMIT</code>,
              <code class="literal">USER LEVEL LOCK</code>,
              <code class="literal">TABLESPACE</code>, or <code class="literal">LOCKING
              SERVICE</code>.
            </p><p>
              A value of <code class="literal">USER LEVEL LOCK</code> indicates a
              lock acquired with
              <a class="link" href="functions.html#function_get-lock"><code class="literal">GET_LOCK()</code></a>. A value of
              <code class="literal">LOCKING SERVICE</code> indicates a lock
              acquired using the locking service described in
              <a class="xref" href="extending-mysql.html#locking-service" title="28.3.1 The Locking Service">Section 28.3.1, “The Locking Service”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_SCHEMA</code>
            </p><p>
              The schema that contains the object.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_NAME</code>
            </p><p>
              The name of the instrumented object.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              The address in memory of the instrumented object.
            </p></li><li class="listitem"><p>
              <code class="literal">LOCK_TYPE</code>
            </p><p>
              The lock type from the metadata lock subsystem. The value
              is one of <code class="literal">INTENTION_EXCLUSIVE</code>,
              <code class="literal">SHARED</code>,
              <code class="literal">SHARED_HIGH_PRIO</code>,
              <code class="literal">SHARED_READ</code>,
              <code class="literal">SHARED_WRITE</code>,
              <code class="literal">SHARED_UPGRADABLE</code>,
              <code class="literal">SHARED_NO_WRITE</code>,
              <code class="literal">SHARED_NO_READ_WRITE</code>, or
              <code class="literal">EXCLUSIVE</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">LOCK_DURATION</code>
            </p><p>
              The lock duration from the metadata lock subsystem. The
              value is one of <code class="literal">STATEMENT</code>,
              <code class="literal">TRANSACTION</code>, or
              <code class="literal">EXPLICIT</code>. The
              <code class="literal">STATEMENT</code> and
              <code class="literal">TRANSACTION</code> values signify locks that
              are released at statement or transaction end,
              respectively. The <code class="literal">EXPLICIT</code> value
              signifies locks that survive statement or transaction end
              and are released explicitly, such as global locks acquired
              with <a class="link" href="sql-syntax.html#flush-tables-with-read-lock"><code class="literal">FLUSH TABLES WITH READ
              LOCK</code></a>.
            </p></li><li class="listitem"><p>
              <code class="literal">LOCK_STATUS</code>
            </p><p>
              The lock status from the metadata lock subsystem. The
              value is one of <code class="literal">PENDING</code>,
              <code class="literal">GRANTED</code>, <code class="literal">VICTIM</code>,
              <code class="literal">TIMEOUT</code>, <code class="literal">KILLED</code>,
              <code class="literal">PRE_ACQUIRE_NOTIFY</code>, or
              <code class="literal">POST_RELEASE_NOTIFY</code>. The Performance
              Schema assigns these values as described previously.
            </p></li><li class="listitem"><p>
              <code class="literal">SOURCE</code>
            </p><p>
              The name of the source file containing the instrumented
              code that produced the event and the line number in the
              file at which the instrumentation occurs. This enables you
              to check the source to determine exactly what code is
              involved.
            </p></li><li class="listitem"><p>
              <code class="literal">OWNER_THREAD_ID</code>
            </p><p>
              The thread requesting a metadata lock.
            </p></li><li class="listitem"><p>
              <code class="literal">OWNER_EVENT_ID</code>
            </p><p>
              The event requesting a metadata lock.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#metadata-locks-table" title="25.11.12.1 The metadata_locks Table"><code class="literal">metadata_locks</code></a> table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="table-handles-table"></a>25.11.12.2 The table_handles Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684627648896"></a><a class="indexterm" name="idm139684627647408"></a><p>
          The Performance Schema exposes table lock information through
          the <a class="link" href="performance-schema.html#table-handles-table" title="25.11.12.2 The table_handles Table"><code class="literal">table_handles</code></a> table to show
          the table locks currently in effect for each opened table
          handle. <a class="link" href="performance-schema.html#table-handles-table" title="25.11.12.2 The table_handles Table"><code class="literal">table_handles</code></a> reports
          what is recorded by the table lock instrumentation. This
          information shows which table handles the server has open, how
          they are locked, and by which sessions.
        </p><p>
          The <a class="link" href="performance-schema.html#table-handles-table" title="25.11.12.2 The table_handles Table"><code class="literal">table_handles</code></a> table is read
          only and cannot be updated. It is autosized by default; to
          configure the table size, set the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_handles"><code class="literal">performance_schema_max_table_handles</code></a>
          system variable at server startup.
        </p><p>
          The <a class="link" href="performance-schema.html#table-handles-table" title="25.11.12.2 The table_handles Table"><code class="literal">table_handles</code></a> table has these
          columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">OBJECT_TYPE</code>
            </p><p>
              The table opened by a table handle.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_SCHEMA</code>
            </p><p>
              The schema that contains the object.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_NAME</code>
            </p><p>
              The name of the instrumented object.
            </p></li><li class="listitem"><p>
              <code class="literal">OBJECT_INSTANCE_BEGIN</code>
            </p><p>
              The table handle address in memory.
            </p></li><li class="listitem"><p>
              <code class="literal">OWNER_THREAD_ID</code>
            </p><p>
              The thread owning the table handle.
            </p></li><li class="listitem"><p>
              <code class="literal">OWNER_EVENT_ID</code>
            </p><p>
              The event which caused the table handle to be opened.
            </p></li><li class="listitem"><p>
              <code class="literal">INTERNAL_LOCK</code>
            </p><p>
              The table lock used at the SQL level. The value is one of
              <code class="literal">READ</code>, <code class="literal">READ WITH SHARED
              LOCKS</code>, <code class="literal">READ HIGH PRIORITY</code>,
              <code class="literal">READ NO INSERT</code>, <code class="literal">WRITE ALLOW
              WRITE</code>, <code class="literal">WRITE CONCURRENT
              INSERT</code>, <code class="literal">WRITE LOW PRIORITY</code>,
              or <code class="literal">WRITE</code>. For information about these
              lock types, see the
              <code class="filename">include/thr_lock.h</code> source file.
            </p></li><li class="listitem"><p>
              <code class="literal">EXTERNAL_LOCK</code>
            </p><p>
              The table lock used at the storage engine level. The value
              is one of <code class="literal">READ EXTERNAL</code> or
              <code class="literal">WRITE EXTERNAL</code>.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#table-handles-table" title="25.11.12.2 The table_handles Table"><code class="literal">table_handles</code></a> table.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-system-variable-tables"></a>25.11.13 Performance Schema System Variable Tables</h3>

</div>

</div>

</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
          The value of the
          <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56</code></a> system
          variable affects the information available from the tables
          described here. For details, see the description of that
          variable in <a class="xref" href="server-administration.html#server-system-variables" title="5.1.7 Server System Variables">Section 5.1.7, “Server System Variables”</a>.
</p>
</div>
<p>
        The MySQL server maintains many system variables that indicate
        how it is configured (see
        <a class="xref" href="server-administration.html#server-system-variables" title="5.1.7 Server System Variables">Section 5.1.7, “Server System Variables”</a>). System variable
        information is available in these Performance Schema tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">global_variables</code></a>: Global system
            variables. An application that wants only global values
            should use this table.
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">session_variables</code></a>: System
            variables for the current session. An application that wants
            all system variable values for its own session should use
            this table. It includes the session variables for its
            session, as well as the values of global variables that have
            no session counterpart.
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">variables_by_thread</code></a>: Session
            system variables for each active session. An application
            that wants to know the session variable values for specific
            sessions should use this table. It includes session
            variables only, identified by thread ID.
</p></li></ul>
</div>
<p>
        The session variable tables
        (<a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">session_variables</code></a>,
        <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">variables_by_thread</code></a>) contain
        information only for active sessions, not terminated sessions.
      </p><p>
        <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not supported
        for Performance Schema system variable tables.
      </p><p>
        The <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">global_variables</code></a> and
        <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">session_variables</code></a> tables have these
        columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">VARIABLE_NAME</code>
          </p><p>
            The system variable name.
          </p></li><li class="listitem"><p>
            <code class="literal">VARIABLE_VALUE</code>
          </p><p>
            The system variable value. For
            <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">global_variables</code></a>, this column
            contains the global value. For
            <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">session_variables</code></a>, this column
            contains the variable value in effect for the current
            session.
</p></li></ul>
</div>
<p>
        The <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">variables_by_thread</code></a> table has
        these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">THREAD_ID</code>
          </p><p>
            The thread identifier of the session in which the system
            variable is defined.
          </p></li><li class="listitem"><p>
            <code class="literal">VARIABLE_NAME</code>
          </p><p>
            The system variable name.
          </p></li><li class="listitem"><p>
            <code class="literal">VARIABLE_VALUE</code>
          </p><p>
            The session variable value for the session named by the
            <code class="literal">THREAD_ID</code> column.
</p></li></ul>
</div>
<p>
        The <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">variables_by_thread</code></a> table
        contains system variable information only about foreground
        threads. If not all threads are instrumented by the Performance
        Schema, this table will miss some rows. In this case, the
        <a class="link" href="performance-schema.html#statvar_Performance_schema_thread_instances_lost"><code class="literal">Performance_schema_thread_instances_lost</code></a>
        status variable will be greater than zero.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-status-variable-tables"></a>25.11.14 Performance Schema Status Variable Tables</h3>

</div>

</div>

</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
          The value of the
          <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56</code></a> system
          variable affects the information available from the tables
          described here. For details, see the description of that
          variable in <a class="xref" href="server-administration.html#server-system-variables" title="5.1.7 Server System Variables">Section 5.1.7, “Server System Variables”</a>.
</p>
</div>
<p>
        The MySQL server maintains many status variables that provide
        information about its operation (see
        <a class="xref" href="server-administration.html#server-status-variables" title="5.1.9 Server Status Variables">Section 5.1.9, “Server Status Variables”</a>). Status variable
        information is available in these Performance Schema tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">global_status</code></a>: Global status
            variables. An application that wants only global values
            should use this table.
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">session_status</code></a>: Status
            variables for the current session. An application that wants
            all status variable values for its own session should use
            this table. It includes the session variables for its
            session, as well as the values of global variables that have
            no session counterpart.
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">status_by_thread</code></a>: Session
            status variables for each active session. An application
            that wants to know the session variable values for specific
            sessions should use this table. It includes session
            variables only, identified by thread ID.
</p></li></ul>
</div>
<p>
        There are also summary tables that provide status variable
        information aggregated by account, host name, and user name. See
        <a class="xref" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables">Section 25.11.15.10, “Status Variable Summary Tables”</a>.
      </p><p>
        The session variable tables
        (<a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">session_status</code></a>,
        <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">status_by_thread</code></a>) contain
        information only for active sessions, not terminated sessions.
      </p><p>
        The Performance Schema collects statistics for global status
        variables only for threads for which the
        <code class="literal">INSTRUMENTED</code> value is <code class="literal">YES</code>
        in the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table. Statistics
        for session status variables are always collected, regardless of
        the <code class="literal">INSTRUMENTED</code> value.
      </p><p>
        The Performance Schema does not collect statistics for
        <code class="literal">Com_<em class="replaceable"><code>xxx</code></em></code> status
        variables in the status variable tables. To obtain global and
        per-session statement execution counts, use the
        <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_global_by_event_name</code></a>
        and
        <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_thread_by_event_name</code></a>
        tables, respectively. For example:
      </p><pre data-lang="sql" class="programlisting">
SELECT EVENT_NAME, COUNT_STAR
FROM events_statements_summary_global_by_event_name
WHERE EVENT_NAME LIKE 'statement/sql/%';
</pre><p>
        The <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">global_status</code></a> and
        <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">session_status</code></a> tables have these
        columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">VARIABLE_NAME</code>
          </p><p>
            The status variable name.
          </p></li><li class="listitem"><p>
            <code class="literal">VARIABLE_VALUE</code>
          </p><p>
            The status variable value. For
            <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">global_status</code></a>, this column
            contains the global value. For
            <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">session_status</code></a>, this column
            contains the variable value for the current session.
</p></li></ul>
</div>
<p>
        The <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">status_by_thread</code></a> table contains
        the status of each active thread. It has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <code class="literal">THREAD_ID</code>
          </p><p>
            The thread identifier of the session in which the status
            variable is defined.
          </p></li><li class="listitem"><p>
            <code class="literal">VARIABLE_NAME</code>
          </p><p>
            The status variable name.
          </p></li><li class="listitem"><p>
            <code class="literal">VARIABLE_VALUE</code>
          </p><p>
            The session variable value for the session named by the
            <code class="literal">THREAD_ID</code> column.
</p></li></ul>
</div>
<p>
        The <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">status_by_thread</code></a> table contains
        status variable information only about foreground threads. If
        the
        <a class="link" href="performance-schema.html#sysvar_performance_schema_max_thread_instances"><code class="literal">performance_schema_max_thread_instances</code></a>
        system variable is not autoscaled (signified by a value of
        −1) and the maximum permitted number of instrumented
        thread objects is not greater than the number of background
        threads, the table will be empty.
      </p><p>
        The Performance Schema supports <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE
        TABLE</code></a> for status variable tables as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">global_status</code></a>: Resets thread,
            account, host, and user status. Resets global status
            variables except those that the server never resets.
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">session_status</code></a>: Not supported.
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">status_by_thread</code></a>: Aggregates
            status for all threads to the global status and account
            status, then resets thread status. If account statistics are
            not collected, the session status is added to host and user
            status, if host and user status are collected.
          </p><p>
            Account, host, and user statistics are not collected if the
            <a class="link" href="performance-schema.html#sysvar_performance_schema_accounts_size"><code class="literal">performance_schema_accounts_size</code></a>,
            <a class="link" href="performance-schema.html#sysvar_performance_schema_hosts_size"><code class="literal">performance_schema_hosts_size</code></a>,
            and
            <a class="link" href="performance-schema.html#sysvar_performance_schema_users_size"><code class="literal">performance_schema_users_size</code></a>
            system variables, respectively, are set to 0.
</p></li></ul>
</div>
<p>
        <a class="link" href="sql-syntax.html#flush-status"><code class="literal">FLUSH STATUS</code></a> adds the session
        status from all active sessions to the global status variables,
        resets the status of all active sessions, and resets account,
        host, and user status values aggregated from disconnected
        sessions.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-summary-tables"></a>25.11.15 Performance Schema Summary Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#wait-summary-tables">25.11.15.1 Wait Event Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#stage-summary-tables">25.11.15.2 Stage Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#statement-summary-tables">25.11.15.3 Statement Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#transaction-summary-tables">25.11.15.4 Transaction Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#objects-summary-global-by-type-table">25.11.15.5 Object Wait Summary Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#file-summary-tables">25.11.15.6 File I/O Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#table-waits-summary-tables">25.11.15.7 Table I/O and Lock Wait Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#socket-summary-tables">25.11.15.8 Socket Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#memory-summary-tables">25.11.15.9 Memory Summary Tables</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-schema-status-variable-summary-tables">25.11.15.10 Status Variable Summary Tables</a></span></dt></dl>
</div>
<p>
        Summary tables provide aggregated information for terminated
        events over time. The tables in this group summarize event data
        in different ways.
</p>
<h4><a name="idm139684627505952"></a>Wait Event Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_waits_summary_by_account_by_event_name</code></a>:
            Wait events per account and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_waits_summary_by_host_by_event_name</code></a>:
            Wait events per host name and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_by_instance</code></a>:
            Wait events per instance
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_by_thread_by_event_name</code></a>:
            Wait events per thread and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_waits_summary_by_user_by_event_name</code></a>:
            Wait events per user name and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_global_by_event_name</code></a>:
            Wait events per event name
</p></li></ul>
</div>
<h4><a name="idm139684627492448"></a>Stage Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_account_by_event_name</code></a>:
            Stage events per account and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_host_by_event_name</code></a>:
            Stage events per host name and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_thread_by_event_name</code></a>:
            Stage waits per thread and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_user_by_event_name</code></a>:
            Stage events per user name and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_global_by_event_name</code></a>:
            Stage waits per event name
</p></li></ul>
</div>
<h4><a name="idm139684627480992"></a>Statement Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_account_by_event_name</code></a>:
            Statement events per account and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>:
            Statement events per schema and digest value
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_host_by_event_name</code></a>:
            Statement events per host name and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_program</code></a>:
            Statement events per stored program (stored procedures and
            functions, triggers, and events)
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_thread_by_event_name</code></a>:
            Statement events per thread and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_user_by_event_name</code></a>:
            Statement events per user name and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_global_by_event_name</code></a>:
            Statement events per event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>:
            Prepared statement instances and statistics
</p></li></ul>
</div>
<h4><a name="idm139684627463008"></a>Transaction Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_account_by_event_name</code></a>:
            Transaction events per account and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_host_by_event_name</code></a>:
            Transaction events per host name and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_thread_by_event_name</code></a>:
            Transaction events per thread and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_user_by_event_name</code></a>:
            Transaction events per user name and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_global_by_event_name</code></a>:
            Transaction events per event name
</p></li></ul>
</div>
<h4><a name="idm139684627451296"></a>Object Wait Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#objects-summary-global-by-type-table" title="25.11.15.5 Object Wait Summary Table"><code class="literal">objects_summary_global_by_type</code></a>:
            Object summaries
</p></li></ul>
</div>
<h4><a name="idm139684627448192"></a>File I/O Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#file-summary-tables" title="25.11.15.6 File I/O Summary Tables"><code class="literal">file_summary_by_event_name</code></a>:
            File events per event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#file-summary-tables" title="25.11.15.6 File I/O Summary Tables"><code class="literal">file_summary_by_instance</code></a>: File
            events per file instance
</p></li></ul>
</div>
<h4><a name="idm139684627443024"></a>Table I/O and Lock Wait Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-index-usage-table" title="25.11.15.7.2 The table_io_waits_summary_by_index_usage Table"><code class="literal">table_io_waits_summary_by_index_usage</code></a>:
            Table I/O waits per index
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-table-table" title="25.11.15.7.1 The table_io_waits_summary_by_table Table"><code class="literal">table_io_waits_summary_by_table</code></a>:
            Table I/O waits per table
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#table-lock-waits-summary-by-table-table" title="25.11.15.7.3 The table_lock_waits_summary_by_table Table"><code class="literal">table_lock_waits_summary_by_table</code></a>:
            Table lock waits per table
</p></li></ul>
</div>
<h4><a name="idm139684627435648"></a>Socket Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_instance</code></a>:
            Socket waits and I/O per instance
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_event_name</code></a>:
            Socket waits and I/O per event name
</p></li></ul>
</div>
<h4><a name="idm139684627430448"></a>Memory Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_account_by_event_name</code></a>:
            Memory operations per account and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_host_by_event_name</code></a>:
            Memory operations per host and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_thread_by_event_name</code></a>:
            Memory operations per thread and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_user_by_event_name</code></a>:
            Memory operations per user and event name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_global_by_event_name</code></a>:
            Memory operations globally per event name
</p></li></ul>
</div>
<h4><a name="idm139684627419056"></a>Status Variable Summaries</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_account</code></a>: Status
            variables per account
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_host</code></a>: Status
            variables per host name
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_user</code></a>: Status
            variables per user name
</p></li></ul>
</div>
<p>
        Each summary table has grouping columns that determine how to
        group the data to be aggregated, and summary columns that
        contain the aggregated values. Tables that summarize events in
        similar ways often have similar sets of summary columns and
        differ only in the grouping columns used to determine how events
        are aggregated.
      </p><p>
        Summary tables can be truncated with
        <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a>. Generally, the
        effect is to reset the summary columns to 0 or
        <code class="literal">NULL</code>, not to remove rows. This enables you to
        clear collected values and restart aggregation. That might be
        useful, for example, after you have made a runtime configuration
        change. Exceptions to this truncation behavior are noted in
        individual summary table sections.
</p>
<div class="section">

<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="wait-summary-tables"></a>25.11.15.1 Wait Event Summary Tables</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm139684627406976"></a><a class="indexterm" name="idm139684627405488"></a><a class="indexterm" name="idm139684627403968"></a><a class="indexterm" name="idm139684627402448"></a><a class="indexterm" name="idm139684627400928"></a><a class="indexterm" name="idm139684627399424"></a><a class="indexterm" name="idm139684627397920"></a><a class="indexterm" name="idm139684627396400"></a><a class="indexterm" name="idm139684627394880"></a><a class="indexterm" name="idm139684627393360"></a><a class="indexterm" name="idm139684627391840"></a><a class="indexterm" name="idm139684627390320"></a><p>
          The Performance Schema maintains tables for collecting current
          and recent wait events, and aggregates that information in
          summary tables.
          <a class="xref" href="performance-schema.html#performance-schema-wait-tables" title="25.11.4 Performance Schema Wait Event Tables">Section 25.11.4, “Performance Schema Wait Event Tables”</a> describes the
          events on which wait summaries are based. See that discussion
          for information about the content of wait events, the current
          and recent wait event tables, and how to control wait event
          collection, which is disabled by default.
        </p><p>
          Example wait event summary information:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM events_waits_summary_global_by_event_name\G</code></strong>
...
*************************** 6. row ***************************
    EVENT_NAME: wait/synch/mutex/sql/BINARY_LOG::LOCK_index
    COUNT_STAR: 8
SUM_TIMER_WAIT: 2119302
MIN_TIMER_WAIT: 196092
AVG_TIMER_WAIT: 264912
MAX_TIMER_WAIT: 569421
...
*************************** 9. row ***************************
    EVENT_NAME: wait/synch/mutex/sql/hash_filo::lock
    COUNT_STAR: 69
SUM_TIMER_WAIT: 16848828
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 244185
MAX_TIMER_WAIT: 735345
...
</pre><p>
          Each wait event summary table has one or more grouping columns
          to indicate how the table aggregates events. Event names refer
          to names of event instruments in the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_waits_summary_by_account_by_event_name</code></a>
              has <code class="literal">EVENT_NAME</code>,
              <code class="literal">USER</code>, and <code class="literal">HOST</code>
              columns. Each row summarizes events for a given account
              (user and host combination) and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_waits_summary_by_host_by_event_name</code></a>
              has <code class="literal">EVENT_NAME</code> and
              <code class="literal">HOST</code> columns. Each row summarizes
              events for a given host and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_by_instance</code></a>
              has <code class="literal">EVENT_NAME</code> and
              <code class="literal">OBJECT_INSTANCE_BEGIN</code> columns. Each row
              summarizes events for a given event name and object. If an
              instrument is used to create multiple instances, each
              instance has a unique
              <code class="literal">OBJECT_INSTANCE_BEGIN</code> value and is
              summarized separately in this table.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_by_thread_by_event_name</code></a>
              has <code class="literal">THREAD_ID</code> and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given thread and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_waits_summary_by_user_by_event_name</code></a>
              has <code class="literal">EVENT_NAME</code> and
              <code class="literal">USER</code> columns. Each row summarizes
              events for a given user and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_global_by_event_name</code></a>
              has an <code class="literal">EVENT_NAME</code> column. Each row
              summarizes events for a given event name. An instrument
              might be used to create multiple instances of the
              instrumented object. For example, if there is an
              instrument for a mutex that is created for each
              connection, there are as many instances as there are
              connections. The summary row for the instrument summarizes
              over all these instances.
</p></li></ul>
</div>
<p>
          Each wait event summary table has these summary columns
          containing aggregated values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">COUNT_STAR</code>
            </p><p>
              The number of summarized events. This value includes all
              events, whether timed or nontimed.
            </p></li><li class="listitem"><p>
              <code class="literal">SUM_TIMER_WAIT</code>
            </p><p>
              The total wait time of the summarized timed events. This
              value is calculated only for timed events because nontimed
              events have a wait time of <code class="literal">NULL</code>. The
              same is true for the other
              <code class="literal"><em class="replaceable"><code>xxx</code></em>_TIMER_WAIT</code>
              values.
            </p></li><li class="listitem"><p>
              <code class="literal">MIN_TIMER_WAIT</code>
            </p><p>
              The minimum wait time of the summarized timed events.
            </p></li><li class="listitem"><p>
              <code class="literal">AVG_TIMER_WAIT</code>
            </p><p>
              The average wait time of the summarized timed events.
            </p></li><li class="listitem"><p>
              <code class="literal">MAX_TIMER_WAIT</code>
            </p><p>
              The maximum wait time of the summarized timed events.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          wait summary tables. It has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              For summary tables not aggregated by account, host, or
              user, truncation resets the summary columns to zero rather
              than removing rows.
            </p></li><li class="listitem"><p>
              For summary tables aggregated by account, host, or user,
              truncation removes rows for accounts, hosts, or users with
              no connections, and resets the summary columns to zero for
              the remaining rows.
</p></li></ul>
</div>
<p>
          In addition, each wait summary table that is aggregated by
          account, host, user, or thread is implicitly truncated by
          truncation of the connection table on which it depends, or
          truncation of
          <a class="link" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables"><code class="literal">events_waits_summary_global_by_event_name</code></a>.
          For details, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-tables" title="25.11.8 Performance Schema Connection Tables">Section 25.11.8, “Performance Schema Connection Tables”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="stage-summary-tables"></a>25.11.15.2 Stage Summary Tables</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684627339312"></a><a class="indexterm" name="idm139684627337792"></a><a class="indexterm" name="idm139684627336272"></a><a class="indexterm" name="idm139684627334752"></a><a class="indexterm" name="idm139684627333232"></a><a class="indexterm" name="idm139684627331712"></a><a class="indexterm" name="idm139684627330192"></a><a class="indexterm" name="idm139684627328672"></a><a class="indexterm" name="idm139684627327152"></a><a class="indexterm" name="idm139684627325632"></a><p>
          The Performance Schema maintains tables for collecting current
          and recent stage events, and aggregates that information in
          summary tables.
          <a class="xref" href="performance-schema.html#performance-schema-stage-tables" title="25.11.5 Performance Schema Stage Event Tables">Section 25.11.5, “Performance Schema Stage Event Tables”</a> describes
          the events on which stage summaries are based. See that
          discussion for information about the content of stage events,
          the current and recent stage event tables, and how to control
          stage event collection, which is disabled by default.
        </p><p>
          Example stage event summary information:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM events_stages_summary_global_by_event_name\G</code></strong>
...
*************************** 5. row ***************************
    EVENT_NAME: stage/sql/checking permissions
    COUNT_STAR: 57
SUM_TIMER_WAIT: 26501888880
MIN_TIMER_WAIT: 7317456
AVG_TIMER_WAIT: 464945295
MAX_TIMER_WAIT: 12858936792
...
*************************** 9. row ***************************
    EVENT_NAME: stage/sql/closing tables
    COUNT_STAR: 37
SUM_TIMER_WAIT: 662606568
MIN_TIMER_WAIT: 1593864
AVG_TIMER_WAIT: 17907891
MAX_TIMER_WAIT: 437977248
...
</pre><p>
          Each stage summary table has one or more grouping columns to
          indicate how the table aggregates events. Event names refer to
          names of event instruments in the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_account_by_event_name</code></a>
              has <code class="literal">EVENT_NAME</code>,
              <code class="literal">USER</code>, and <code class="literal">HOST</code>
              columns. Each row summarizes events for a given account
              (user and host combination) and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_host_by_event_name</code></a>
              has <code class="literal">EVENT_NAME</code> and
              <code class="literal">HOST</code> columns. Each row summarizes
              events for a given host and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_thread_by_event_name</code></a>
              has <code class="literal">THREAD_ID</code> and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given thread and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_by_user_by_event_name</code></a>
              has <code class="literal">EVENT_NAME</code> and
              <code class="literal">USER</code> columns. Each row summarizes
              events for a given user and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_global_by_event_name</code></a>
              has an <code class="literal">EVENT_NAME</code> column. Each row
              summarizes events for a given event name.
</p></li></ul>
</div>
<p>
          Each stage summary table has these summary columns containing
          aggregated values: <code class="literal">COUNT_STAR</code>,
          <code class="literal">SUM_TIMER_WAIT</code>,
          <code class="literal">MIN_TIMER_WAIT</code>,
          <code class="literal">AVG_TIMER_WAIT</code>, and
          <code class="literal">MAX_TIMER_WAIT</code>. These columns are analogous
          to the columns of the same names in the wait event summary
          tables (see <a class="xref" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables">Section 25.11.15.1, “Wait Event Summary Tables”</a>), except
          that the stage summary tables aggregate events from
          <a class="link" href="performance-schema.html#events-stages-current-table" title="25.11.5.1 The events_stages_current Table"><code class="literal">events_stages_current</code></a> rather than
          <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          stage summary tables. It has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              For summary tables not aggregated by account, host, or
              user, truncation resets the summary columns to zero rather
              than removing rows.
            </p></li><li class="listitem"><p>
              For summary tables aggregated by account, host, or user,
              truncation removes rows for accounts, hosts, or users with
              no connections, and resets the summary columns to zero for
              the remaining rows.
</p></li></ul>
</div>
<p>
          In addition, each stage summary table that is aggregated by
          account, host, user, or thread is implicitly truncated by
          truncation of the connection table on which it depends, or
          truncation of
          <a class="link" href="performance-schema.html#stage-summary-tables" title="25.11.15.2 Stage Summary Tables"><code class="literal">events_stages_summary_global_by_event_name</code></a>.
          For details, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-tables" title="25.11.8 Performance Schema Connection Tables">Section 25.11.8, “Performance Schema Connection Tables”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="statement-summary-tables"></a>25.11.15.3 Statement Summary Tables</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684627284512"></a><a class="indexterm" name="idm139684627282976"></a><a class="indexterm" name="idm139684627281440"></a><a class="indexterm" name="idm139684627279920"></a><a class="indexterm" name="idm139684627278400"></a><a class="indexterm" name="idm139684627276880"></a><a class="indexterm" name="idm139684627275360"></a><a class="indexterm" name="idm139684627273840"></a><a class="indexterm" name="idm139684627272320"></a><a class="indexterm" name="idm139684627270800"></a><a class="indexterm" name="idm139684627269280"></a><a class="indexterm" name="idm139684627267760"></a><a class="indexterm" name="idm139684627266240"></a><a class="indexterm" name="idm139684627264720"></a><a class="indexterm" name="idm139684627263200"></a><a class="indexterm" name="idm139684627261696"></a><p>
          The Performance Schema maintains tables for collecting current
          and recent statement events, and aggregates that information
          in summary tables.
          <a class="xref" href="performance-schema.html#performance-schema-statement-tables" title="25.11.6 Performance Schema Statement Event Tables">Section 25.11.6, “Performance Schema Statement Event Tables”</a>
          describes the events on which statement summaries are based.
          See that discussion for information about the content of
          statement events, the current and recent statement event
          tables, and how to control statement event collection, which
          is partially disabled by default.
        </p><p>
          Example statement event summary information:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM events_statements_summary_global_by_event_name\G</code></strong>
*************************** 1. row ***************************
                 EVENT_NAME: statement/sql/select
                 COUNT_STAR: 25
             SUM_TIMER_WAIT: 1535983999000
             MIN_TIMER_WAIT: 209823000
             AVG_TIMER_WAIT: 61439359000
             MAX_TIMER_WAIT: 1363397650000
              SUM_LOCK_TIME: 20186000000
                 SUM_ERRORS: 0
               SUM_WARNINGS: 0
          SUM_ROWS_AFFECTED: 0
              SUM_ROWS_SENT: 388
          SUM_ROWS_EXAMINED: 370
SUM_CREATED_TMP_DISK_TABLES: 0
     SUM_CREATED_TMP_TABLES: 0
       SUM_SELECT_FULL_JOIN: 0
 SUM_SELECT_FULL_RANGE_JOIN: 0
           SUM_SELECT_RANGE: 0
     SUM_SELECT_RANGE_CHECK: 0
            SUM_SELECT_SCAN: 6
      SUM_SORT_MERGE_PASSES: 0
             SUM_SORT_RANGE: 0
              SUM_SORT_ROWS: 0
              SUM_SORT_SCAN: 0
          SUM_NO_INDEX_USED: 6
     SUM_NO_GOOD_INDEX_USED: 0
...
</pre><p>
          Each statement summary table has one or more grouping columns
          to indicate how the table aggregates events. Event names refer
          to names of event instruments in the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_account_by_event_name</code></a>
              has <code class="literal">EVENT_NAME</code>,
              <code class="literal">USER</code>, and <code class="literal">HOST</code>
              columns. Each row summarizes events for a given account
              (user and host combination) and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>
              has <code class="literal">SCHEMA_NAME</code> and
              <code class="literal">DIGEST</code> columns. Each row summarizes
              events per schema and digest value. (The
              <code class="literal">DIGEST_TEXT</code> column contains the
              corresponding normalized statement digest text, but is
              neither a grouping nor a summary column.)
            </p><p>
              The maximum number of rows in the table is autosized at
              server startup. To set this maximum explicitly, set the
              <a class="link" href="performance-schema.html#sysvar_performance_schema_digests_size"><code class="literal">performance_schema_digests_size</code></a>
              system variable at server startup.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_host_by_event_name</code></a>
              has <code class="literal">EVENT_NAME</code> and
              <code class="literal">HOST</code> columns. Each row summarizes
              events for a given host and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_program</code></a>
              has <code class="literal">OBJECT_TYPE</code>,
              <code class="literal">OBJECT_SCHEMA</code>, and
              <code class="literal">OBJECT_NAME</code> columns. Each row
              summarizes events for a given stored program (stored
              procedure or function, trigger, or event).
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_thread_by_event_name</code></a>
              has <code class="literal">THREAD_ID</code> and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given thread and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_user_by_event_name</code></a>
              has <code class="literal">EVENT_NAME</code> and
              <code class="literal">USER</code> columns. Each row summarizes
              events for a given user and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_global_by_event_name</code></a>
              has an <code class="literal">EVENT_NAME</code> column. Each row
              summarizes events for a given event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
              has an <code class="literal">OBJECT_INSTANCE_BEGIN</code> column.
              Each row summarizes events for a given prepared statement.
</p></li></ul>
</div>
<p>
          Each statement summary table has these summary columns
          containing aggregated values (with exceptions as noted):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">COUNT_STAR</code>,
              <code class="literal">SUM_TIMER_WAIT</code>,
              <code class="literal">MIN_TIMER_WAIT</code>,
              <code class="literal">AVG_TIMER_WAIT</code>,
              <code class="literal">MAX_TIMER_WAIT</code>
            </p><p>
              These columns are analogous to the columns of the same
              names in the wait event summary tables (see
              <a class="xref" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables">Section 25.11.15.1, “Wait Event Summary Tables”</a>), except that the
              statement summary tables aggregate events from
              <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>
              rather than
              <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>.
            </p><p>
              The
              <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
              table does not have these columns.
            </p></li><li class="listitem"><p>
              <code class="literal">SUM_<em class="replaceable"><code>xxx</code></em></code>
            </p><p>
              The aggregate of the corresponding
              <em class="replaceable"><code>xxx</code></em> column in the
              <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>
              table. For example, the <code class="literal">SUM_LOCK_TIME</code>
              and <code class="literal">SUM_ERRORS</code> columns in statement
              summary tables are the aggregates of the
              <code class="literal">LOCK_TIME</code> and <code class="literal">ERRORS</code>
              columns in
              <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>
              table.
</p></li></ul>
</div>
<p>
          The
          <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>
          table has these additional summary columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">FIRST_SEEN</code>,
              <code class="literal">LAST_SEEN</code>
            </p><p>
              Timestamps indicating when statements with the given
              digest value were first seen and most recently seen.
</p></li></ul>
</div>
<p>
          The
          <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_program</code></a>
          table has these additional summary columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">COUNT_STATEMENTS</code>,
              <code class="literal">SUM_STATEMENTS_WAIT</code>,
              <code class="literal">MIN_STATEMENTS_WAIT</code>,
              <code class="literal">AVG_STATEMENTS_WAIT</code>,
              <code class="literal">MAX_STATEMENTS_WAIT</code>
            </p><p>
              Statistics about nested statements invoked during stored
              program execution.
</p></li></ul>
</div>
<p>
          The <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
          table has these additional summary columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">COUNT_EXECUTE</code>,
              <code class="literal">SUM_TIMER_EXECUTE</code>,
              <code class="literal">MIN_TIMER_EXECUTE</code>,
              <code class="literal">AVG_TIMER_EXECUTE</code>,
              <code class="literal">MAX_TIMER_EXECUTE</code>
            </p><p>
              Aggregated statistics for executions of the prepared
              statement.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          statement summary tables. It has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              For
              <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>,
              it removes the rows.
            </p></li><li class="listitem"><p>
              For other summary tables not aggregated by account, host,
              or user, truncation resets the summary columns to zero
              rather than removing rows.
            </p></li><li class="listitem"><p>
              For other summary tables aggregated by account, host, or
              user, truncation removes rows for accounts, hosts, or
              users with no connections, and resets the summary columns
              to zero for the remaining rows.
</p></li></ul>
</div>
<p>
          In addition, each statement summary table that is aggregated
          by account, host, user, or thread is implicitly truncated by
          truncation of the connection table on which it depends, or
          truncation of
          <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_global_by_event_name</code></a>.
          For details, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-tables" title="25.11.8 Performance Schema Connection Tables">Section 25.11.8, “Performance Schema Connection Tables”</a>.
</p>
<div class="simplesect">

<div class="titlepage">
<div>

<div class="simple">
<h5 class="title"><a name="statement-summary-tables-aggregation"></a>Statement Digest Aggregation Rules</h5>
</div>
</div>
</div>
<p>
            If the <code class="literal">statements_digest</code> consumer is
            enabled, aggregation into
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>
            occurs as follows when a statement completes. Aggregation is
            based on the <code class="literal">DIGEST</code> value computed for
            the statement.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                If a
                <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>
                row already exists with the digest value for the
                statement that just completed, statistics for the
                statement are aggregated to that row. The
                <code class="literal">LAST_SEEN</code> column is updated to the
                current time.
              </p></li><li class="listitem"><p>
                If no row has the digest value for the statement that
                just completed, and the table is not full, a new row is
                created for the statement. The
                <code class="literal">FIRST_SEEN</code> and
                <code class="literal">LAST_SEEN</code> columns are initialized
                with the current time.
              </p></li><li class="listitem"><p>
                If no row has the statement digest value for the
                statement that just completed, and the table is full,
                the statistics for the statement that just completed are
                added to a special <span class="quote">“<span class="quote">catch-all</span>”</span> row with
                <code class="literal">DIGEST</code> = <code class="literal">NULL</code>,
                which is created if necessary. If the row is created,
                the <code class="literal">FIRST_SEEN</code> and
                <code class="literal">LAST_SEEN</code> columns are initialized
                with the current time. Otherwise, the
                <code class="literal">LAST_SEEN</code> column is updated with the
                current time.
</p></li></ul>
</div>
<p>
            The row with <code class="literal">DIGEST</code> =
            <code class="literal">NULL</code> is maintained because Performance
            Schema tables have a maximum size due to memory constraints.
            The <code class="literal">DIGEST</code> = <code class="literal">NULL</code> row
            permits digests that do not match other rows to be counted
            even if the summary table is full, using a common
            <span class="quote">“<span class="quote">other</span>”</span> bucket. This row helps you estimate
            whether the digest summary is representative:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                A <code class="literal">DIGEST</code> = <code class="literal">NULL</code>
                row that has a <code class="literal">COUNT_STAR</code> value that
                represents 5% of all digests shows that the digest
                summary table is very representative; the other rows
                cover 95% of the statements seen.
              </p></li><li class="listitem"><p>
                A <code class="literal">DIGEST</code> = <code class="literal">NULL</code>
                row that has a <code class="literal">COUNT_STAR</code> value that
                represents 50% of all digests shows that the digest
                summary table is not very representative; the other rows
                cover only half the statements seen. Most likely the DBA
                should increase the maximum table size so that more of
                the rows counted in the <code class="literal">DIGEST</code> =
                <code class="literal">NULL</code> row would be counted using more
                specific rows instead. To do this, set the
                <a class="link" href="performance-schema.html#sysvar_performance_schema_digests_size"><code class="literal">performance_schema_digests_size</code></a>
                system variable to a larger value at server startup. The
                default size is 200.
</p></li></ul>
</div>

</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title"><a name="statement-summary-tables-stored-programs"></a>Stored Program Instrumentation Behavior</h5>

</div>

</div>

</div>
<p>
            For stored program types for which instrumentation is
            enabled in the <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a>
            table,
            <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_program</code></a>
            maintains statistics for stored programs as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                A row is added for an object when it is first used in
                the server.
              </p></li><li class="listitem"><p>
                The row for an object is removed when the object is
                dropped.
              </p></li><li class="listitem"><p>
                Statistics are aggregated in the row for an object as it
                executes.
</p></li></ul>
</div>
<p>
            See also <a class="xref" href="performance-schema.html#performance-schema-pre-filtering" title="25.4.3 Event Pre-Filtering">Section 25.4.3, “Event Pre-Filtering”</a>.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="transaction-summary-tables"></a>25.11.15.4 Transaction Summary Tables</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684627134608"></a><a class="indexterm" name="idm139684627133088"></a><a class="indexterm" name="idm139684627131568"></a><a class="indexterm" name="idm139684627130048"></a><a class="indexterm" name="idm139684627128528"></a><a class="indexterm" name="idm139684627126992"></a><a class="indexterm" name="idm139684627125456"></a><a class="indexterm" name="idm139684627123936"></a><a class="indexterm" name="idm139684627122416"></a><a class="indexterm" name="idm139684627120896"></a><p>
          The Performance Schema maintains tables for collecting current
          and recent transaction events, and aggregates that information
          in summary tables.
          <a class="xref" href="performance-schema.html#performance-schema-transaction-tables" title="25.11.7 Performance Schema Transaction Tables">Section 25.11.7, “Performance Schema Transaction Tables”</a>
          describes the events on which transaction summaries are based.
          See that discussion for information about the content of
          transaction events, the current and recent transaction event
          tables, and how to control transaction event collection, which
          is disabled by default.
        </p><p>
          Example transaction event summary information:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM events_transactions_summary_global_by_event_name LIMIT 1\G</code></strong>
*************************** 1. row ***************************
          EVENT_NAME: transaction
          COUNT_STAR: 5
      SUM_TIMER_WAIT: 19550092000
      MIN_TIMER_WAIT: 2954148000
      AVG_TIMER_WAIT: 3910018000
      MAX_TIMER_WAIT: 5486275000
    COUNT_READ_WRITE: 5
SUM_TIMER_READ_WRITE: 19550092000
MIN_TIMER_READ_WRITE: 2954148000
AVG_TIMER_READ_WRITE: 3910018000
MAX_TIMER_READ_WRITE: 5486275000
     COUNT_READ_ONLY: 0
 SUM_TIMER_READ_ONLY: 0
 MIN_TIMER_READ_ONLY: 0
 AVG_TIMER_READ_ONLY: 0
 MAX_TIMER_READ_ONLY: 0
</pre><p>
          Each transaction summary table has one or more grouping
          columns to indicate how the table aggregates events. Event
          names refer to names of event instruments in the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_account_by_event_name</code></a>
              has <code class="literal">USER</code>, <code class="literal">HOST</code>, and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given account (user and host combination) and
              event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_host_by_event_name</code></a>
              has <code class="literal">HOST</code> and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given host and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_thread_by_event_name</code></a>
              has <code class="literal">THREAD_ID</code> and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given thread and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_by_user_by_event_name</code></a>
              has <code class="literal">USER</code> and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given user and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_global_by_event_name</code></a>
              has an <code class="literal">EVENT_NAME</code> column. Each row
              summarizes events for a given event name.
</p></li></ul>
</div>
<p>
          Each transaction summary table has these summary columns
          containing aggregated values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">COUNT_STAR</code>,
              <code class="literal">SUM_TIMER_WAIT</code>,
              <code class="literal">MIN_TIMER_WAIT</code>,
              <code class="literal">AVG_TIMER_WAIT</code>,
              <code class="literal">MAX_TIMER_WAIT</code>
            </p><p>
              These columns are analogous to the columns of the same
              names in the wait event summary tables (see
              <a class="xref" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables">Section 25.11.15.1, “Wait Event Summary Tables”</a>), except that the
              transaction summary tables aggregate events from
              <a class="link" href="performance-schema.html#events-transactions-current-table" title="25.11.7.1 The events_transactions_current Table"><code class="literal">events_transactions_current</code></a>
              rather than
              <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a>. These
              columns summarize read-write and read-only transactions.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_READ_WRITE</code>,
              <code class="literal">SUM_TIMER_READ_WRITE</code>,
              <code class="literal">MIN_TIMER_READ_WRITE</code>,
              <code class="literal">AVG_TIMER_READ_WRITE</code>,
              <code class="literal">MAX_TIMER_READ_WRITE</code>
            </p><p>
              These are similar to the <code class="literal">COUNT_STAR</code> and
              <code class="literal"><em class="replaceable"><code>xxx</code></em>_TIMER_WAIT</code>
              columns, but summarize read-write transactions only.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_READ_ONLY</code>,
              <code class="literal">SUM_TIMER_READ_ONLY</code>,
              <code class="literal">MIN_TIMER_READ_ONLY</code>,
              <code class="literal">AVG_TIMER_READ_ONLY</code>,
              <code class="literal">MAX_TIMER_READ_ONLY</code>
            </p><p>
              These are similar to the <code class="literal">COUNT_STAR</code> and
              <code class="literal"><em class="replaceable"><code>xxx</code></em>_TIMER_WAIT</code>
              columns, but summarize read-only transactions only.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          transaction summary tables. It has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              For summary tables not aggregated by account, host, or
              user, truncation resets the summary columns to zero rather
              than removing rows.
            </p></li><li class="listitem"><p>
              For summary tables aggregated by account, host, or user,
              truncation removes rows for accounts, hosts, or users with
              no connections, and resets the summary columns to zero for
              the remaining rows.
</p></li></ul>
</div>
<p>
          In addition, each transaction summary table that is aggregated
          by account, host, user, or thread is implicitly truncated by
          truncation of the connection table on which it depends, or
          truncation of
          <a class="link" href="performance-schema.html#transaction-summary-tables" title="25.11.15.4 Transaction Summary Tables"><code class="literal">events_transactions_summary_global_by_event_name</code></a>.
          For details, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-tables" title="25.11.8 Performance Schema Connection Tables">Section 25.11.8, “Performance Schema Connection Tables”</a>.
</p>
<div class="simplesect">

<div class="titlepage">
<div>

<div class="simple">
<h5 class="title"><a name="transaction-summary-tables-aggregation"></a>Transaction Aggregation Rules</h5>
</div>
</div>
</div>
<p>
            Transaction event collection occurs without regard to
            isolation level, access mode, or autocommit mode.
          </p><p>
            Read-write transactions are generally more resource
            intensive than read-only transactions, therefore transaction
            summary tables include separate aggregate columns for
            read-write and read-only transactions.
          </p><p>
            Resource requirements may also vary with transaction
            isolation level. However, presuming that only one isolation
            level would be used per server, aggregation by isolation
            level is not provided.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="objects-summary-global-by-type-table"></a>25.11.15.5 Object Wait Summary Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684627061424"></a><a class="indexterm" name="idm139684627059920"></a><p>
          The Performance Schema maintains the
          <a class="link" href="performance-schema.html#objects-summary-global-by-type-table" title="25.11.15.5 Object Wait Summary Table"><code class="literal">objects_summary_global_by_type</code></a>
          table for aggregating object wait events.
        </p><p>
          Example object wait event summary information:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM objects_summary_global_by_type\G</code></strong>
...
*************************** 3. row ***************************
   OBJECT_TYPE: TABLE
 OBJECT_SCHEMA: test
   OBJECT_NAME: t
    COUNT_STAR: 3
SUM_TIMER_WAIT: 263126976
MIN_TIMER_WAIT: 1522272
AVG_TIMER_WAIT: 87708678
MAX_TIMER_WAIT: 258428280
...
*************************** 10. row ***************************
   OBJECT_TYPE: TABLE
 OBJECT_SCHEMA: mysql
   OBJECT_NAME: user
    COUNT_STAR: 14
SUM_TIMER_WAIT: 365567592
MIN_TIMER_WAIT: 1141704
AVG_TIMER_WAIT: 26111769
MAX_TIMER_WAIT: 334783032
...
</pre><p>
          The
          <a class="link" href="performance-schema.html#objects-summary-global-by-type-table" title="25.11.15.5 Object Wait Summary Table"><code class="literal">objects_summary_global_by_type</code></a>
          table has these grouping columns to indicate how the table
          aggregates events: <code class="literal">OBJECT_TYPE</code>,
          <code class="literal">OBJECT_SCHEMA</code>, and
          <code class="literal">OBJECT_NAME</code>. Each row summarizes events for
          the given object.
        </p><p>
          <a class="link" href="performance-schema.html#objects-summary-global-by-type-table" title="25.11.15.5 Object Wait Summary Table"><code class="literal">objects_summary_global_by_type</code></a>
          has the same summary columns as the
          <code class="literal">events_waits_summary_by_<em class="replaceable"><code>xxx</code></em></code>
          tables. See <a class="xref" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables">Section 25.11.15.1, “Wait Event Summary Tables”</a>.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          the object summary table. It resets the summary columns to
          zero rather than removing rows.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="file-summary-tables"></a>25.11.15.6 File I/O Summary Tables</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684627043632"></a><a class="indexterm" name="idm139684627042128"></a><a class="indexterm" name="idm139684627040624"></a><a class="indexterm" name="idm139684627039120"></a><p>
          The Performance Schema maintains file I/O summary tables that
          aggregate information about I/O operations.
        </p><p>
          Example file I/O event summary information:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM file_summary_by_event_name\G</code></strong>
...
*************************** 2. row ***************************
               EVENT_NAME: wait/io/file/sql/binlog
               COUNT_STAR: 31
           SUM_TIMER_WAIT: 8243784888
           MIN_TIMER_WAIT: 0
           AVG_TIMER_WAIT: 265928484
           MAX_TIMER_WAIT: 6490658832
...
mysql&gt; <strong class="userinput"><code>SELECT * FROM file_summary_by_instance\G</code></strong>
...
*************************** 2. row ***************************
                FILE_NAME: /var/mysql/share/english/errmsg.sys
               EVENT_NAME: wait/io/file/sql/ERRMSG
               EVENT_NAME: wait/io/file/sql/ERRMSG
    OBJECT_INSTANCE_BEGIN: 4686193384
               COUNT_STAR: 5
           SUM_TIMER_WAIT: 13990154448
           MIN_TIMER_WAIT: 26349624
           AVG_TIMER_WAIT: 2798030607
           MAX_TIMER_WAIT: 8150662536
...
</pre><p>
          Each file I/O summary table has one or more grouping columns
          to indicate how the table aggregates events. Event names refer
          to names of event instruments in the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#file-summary-tables" title="25.11.15.6 File I/O Summary Tables"><code class="literal">file_summary_by_event_name</code></a>
              has an <code class="literal">EVENT_NAME</code> column. Each row
              summarizes events for a given event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#file-summary-tables" title="25.11.15.6 File I/O Summary Tables"><code class="literal">file_summary_by_instance</code></a> has
              <code class="literal">FILE_NAME</code>,
              <code class="literal">EVENT_NAME</code>, and
              <code class="literal">OBJECT_INSTANCE_BEGIN</code> columns. Each row
              summarizes events for a given file and event name.
</p></li></ul>
</div>
<p>
          Each file I/O summary table has the following summary columns
          containing aggregated values. Some columns are more general
          and have values that are the same as the sum of the values of
          more fine-grained columns. In this way, aggregations at higher
          levels are available directly without the need for
          user-defined views that sum lower-level columns.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">COUNT_STAR</code>,
              <code class="literal">SUM_TIMER_WAIT</code>,
              <code class="literal">MIN_TIMER_WAIT</code>,
              <code class="literal">AVG_TIMER_WAIT</code>,
              <code class="literal">MAX_TIMER_WAIT</code>
            </p><p>
              These columns aggregate all I/O operations.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_READ</code>,
              <code class="literal">SUM_TIMER_READ</code>,
              <code class="literal">MIN_TIMER_READ</code>,
              <code class="literal">AVG_TIMER_READ</code>,
              <code class="literal">MAX_TIMER_READ</code>,
              <code class="literal">SUM_NUMBER_OF_BYTES_READ</code>
            </p><p>
              These columns aggregate all read operations, including
              <code class="literal">FGETS</code>, <code class="literal">FGETC</code>,
              <code class="literal">FREAD</code>, and <code class="literal">READ</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_WRITE</code>,
              <code class="literal">SUM_TIMER_WRITE</code>,
              <code class="literal">MIN_TIMER_WRITE</code>,
              <code class="literal">AVG_TIMER_WRITE</code>,
              <code class="literal">MAX_TIMER_WRITE</code>,
              <code class="literal">SUM_NUMBER_OF_BYTES_WRITE</code>
            </p><p>
              These columns aggregate all write operations, including
              <code class="literal">FPUTS</code>, <code class="literal">FPUTC</code>,
              <code class="literal">FPRINTF</code>, <code class="literal">VFPRINTF</code>,
              <code class="literal">FWRITE</code>, and <code class="literal">PWRITE</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_MISC</code>,
              <code class="literal">SUM_TIMER_MISC</code>,
              <code class="literal">MIN_TIMER_MISC</code>,
              <code class="literal">AVG_TIMER_MISC</code>,
              <code class="literal">MAX_TIMER_MISC</code>
            </p><p>
              These columns aggregate all other I/O operations,
              including <code class="literal">CREATE</code>,
              <code class="literal">DELETE</code>, <code class="literal">OPEN</code>,
              <code class="literal">CLOSE</code>, <code class="literal">STREAM_OPEN</code>,
              <code class="literal">STREAM_CLOSE</code>, <code class="literal">SEEK</code>,
              <code class="literal">TELL</code>, <code class="literal">FLUSH</code>,
              <code class="literal">STAT</code>, <code class="literal">FSTAT</code>,
              <code class="literal">CHSIZE</code>, <code class="literal">RENAME</code>, and
              <code class="literal">SYNC</code>. There are no byte counts for
              these operations.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          file I/O summary tables. It resets the summary columns to zero
          rather than removing rows.
        </p><p>
          The MySQL server uses several techniques to avoid I/O
          operations by caching information read from files, so it is
          possible that statements you might expect to result in I/O
          events will not. You may be able to ensure that I/O does occur
          by flushing caches or restarting the server to reset its
          state.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="table-waits-summary-tables"></a>25.11.15.7 Table I/O and Lock Wait Summary Tables</h4>

</div>

</div>

</div>
<p>
          The following sections describe the table I/O and lock wait
          summary tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#table-io-waits-summary-by-index-usage-table" title="25.11.15.7.2 The table_io_waits_summary_by_index_usage Table"><code class="literal">table_io_waits_summary_by_index_usage</code></a>:
              Table I/O waits per index
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#table-io-waits-summary-by-table-table" title="25.11.15.7.1 The table_io_waits_summary_by_table Table"><code class="literal">table_io_waits_summary_by_table</code></a>:
              Table I/O waits per table
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#table-lock-waits-summary-by-table-table" title="25.11.15.7.3 The table_lock_waits_summary_by_table Table"><code class="literal">table_lock_waits_summary_by_table</code></a>:
              Table lock waits per table
</p></li></ul>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title"><a name="table-io-waits-summary-by-table-table"></a>25.11.15.7.1 The table_io_waits_summary_by_table Table</h5>

</div>

</div>

</div>
<a class="indexterm" name="idm139684626972672"></a><a class="indexterm" name="idm139684626971216"></a><p>
            The
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-table-table" title="25.11.15.7.1 The table_io_waits_summary_by_table Table"><code class="literal">table_io_waits_summary_by_table</code></a>
            table aggregates all table I/O wait events, as generated by
            the <code class="literal">wait/io/table/sql/handler</code> instrument.
            The grouping is by table.
          </p><p>
            The
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-table-table" title="25.11.15.7.1 The table_io_waits_summary_by_table Table"><code class="literal">table_io_waits_summary_by_table</code></a>
            table has these grouping columns to indicate how the table
            aggregates events: <code class="literal">OBJECT_TYPE</code>,
            <code class="literal">OBJECT_SCHEMA</code>, and
            <code class="literal">OBJECT_NAME</code>. These columns have the same
            meaning as in the
            <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> table.
            They identify the table to which the row applies.
          </p><p>
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-table-table" title="25.11.15.7.1 The table_io_waits_summary_by_table Table"><code class="literal">table_io_waits_summary_by_table</code></a>
            has the following summary columns containing aggregated
            values. As indicated in the column descriptions, some
            columns are more general and have values that are the same
            as the sum of the values of more fine-grained columns. For
            example, columns that aggregate all writes hold the sum of
            the corresponding columns that aggregate inserts, updates,
            and deletes. In this way, aggregations at higher levels are
            available directly without the need for user-defined views
            that sum lower-level columns.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                <code class="literal">COUNT_STAR</code>,
                <code class="literal">SUM_TIMER_WAIT</code>,
                <code class="literal">MIN_TIMER_WAIT</code>,
                <code class="literal">AVG_TIMER_WAIT</code>,
                <code class="literal">MAX_TIMER_WAIT</code>
              </p><p>
                These columns aggregate all I/O operations. They are the
                same as the sum of the corresponding
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_READ</code>
                and
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_WRITE</code>
                columns.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_READ</code>,
                <code class="literal">SUM_TIMER_READ</code>,
                <code class="literal">MIN_TIMER_READ</code>,
                <code class="literal">AVG_TIMER_READ</code>,
                <code class="literal">MAX_TIMER_READ</code>
              </p><p>
                These columns aggregate all read operations. They are
                the same as the sum of the corresponding
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_FETCH</code>
                columns.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_WRITE</code>,
                <code class="literal">SUM_TIMER_WRITE</code>,
                <code class="literal">MIN_TIMER_WRITE</code>,
                <code class="literal">AVG_TIMER_WRITE</code>,
                <code class="literal">MAX_TIMER_WRITE</code>
              </p><p>
                These columns aggregate all write operations. They are
                the same as the sum of the corresponding
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_INSERT</code>,
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_UPDATE</code>,
                and
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_DELETE</code>
                columns.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_FETCH</code>,
                <code class="literal">SUM_TIMER_FETCH</code>,
                <code class="literal">MIN_TIMER_FETCH</code>,
                <code class="literal">AVG_TIMER_FETCH</code>,
                <code class="literal">MAX_TIMER_FETCH</code>
              </p><p>
                These columns aggregate all fetch operations.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_INSERT</code>,
                <code class="literal">SUM_TIMER_INSERT</code>,
                <code class="literal">MIN_TIMER_INSERT</code>,
                <code class="literal">AVG_TIMER_INSERT</code>,
                <code class="literal">MAX_TIMER_INSERT</code>
              </p><p>
                These columns aggregate all insert operations.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_UPDATE</code>,
                <code class="literal">SUM_TIMER_UPDATE</code>,
                <code class="literal">MIN_TIMER_UPDATE</code>,
                <code class="literal">AVG_TIMER_UPDATE</code>,
                <code class="literal">MAX_TIMER_UPDATE</code>
              </p><p>
                These columns aggregate all update operations.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_DELETE</code>,
                <code class="literal">SUM_TIMER_DELETE</code>,
                <code class="literal">MIN_TIMER_DELETE</code>,
                <code class="literal">AVG_TIMER_DELETE</code>,
                <code class="literal">MAX_TIMER_DELETE</code>
              </p><p>
                These columns aggregate all delete operations.
</p></li></ul>
</div>
<p>
            <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted
            for table I/O summary tables. It resets the summary columns
            to zero rather than removing rows. Truncating this table
            also truncates the
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-index-usage-table" title="25.11.15.7.2 The table_io_waits_summary_by_index_usage Table"><code class="literal">table_io_waits_summary_by_index_usage</code></a>
            table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title"><a name="table-io-waits-summary-by-index-usage-table"></a>25.11.15.7.2 The table_io_waits_summary_by_index_usage Table</h5>

</div>

</div>

</div>
<a class="indexterm" name="idm139684626914816"></a><a class="indexterm" name="idm139684626913296"></a><p>
            The
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-index-usage-table" title="25.11.15.7.2 The table_io_waits_summary_by_index_usage Table"><code class="literal">table_io_waits_summary_by_index_usage</code></a>
            table aggregates all table index I/O wait events, as
            generated by the
            <code class="literal">wait/io/table/sql/handler</code> instrument. The
            grouping is by table index.
          </p><p>
            The columns of
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-index-usage-table" title="25.11.15.7.2 The table_io_waits_summary_by_index_usage Table"><code class="literal">table_io_waits_summary_by_index_usage</code></a>
            are nearly identical to
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-table-table" title="25.11.15.7.1 The table_io_waits_summary_by_table Table"><code class="literal">table_io_waits_summary_by_table</code></a>.
            The only difference is the additional group column,
            <code class="literal">INDEX_NAME</code>, which corresponds to the name
            of the index that was used when the table I/O wait event was
            recorded:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                A value of <code class="literal">PRIMARY</code> indicates that
                table I/O used the primary index.
              </p></li><li class="listitem"><p>
                A value of <code class="literal">NULL</code> means that table I/O
                used no index.
              </p></li><li class="listitem"><p>
                Inserts are counted against <code class="literal">INDEX_NAME =
                NULL</code>.
</p></li></ul>
</div>
<p>
            <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted
            for table I/O summary tables. It resets the summary columns
            to zero rather than removing rows. This table is also
            truncated by truncation of the
            <a class="link" href="performance-schema.html#table-io-waits-summary-by-table-table" title="25.11.15.7.1 The table_io_waits_summary_by_table Table"><code class="literal">table_io_waits_summary_by_table</code></a>
            table. A DDL operation that changes the index structure of a
            table may cause the per-index statistics to be reset.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title"><a name="table-lock-waits-summary-by-table-table"></a>25.11.15.7.3 The table_lock_waits_summary_by_table Table</h5>

</div>

</div>

</div>
<a class="indexterm" name="idm139684626895472"></a><a class="indexterm" name="idm139684626894016"></a><p>
            The
            <a class="link" href="performance-schema.html#table-lock-waits-summary-by-table-table" title="25.11.15.7.3 The table_lock_waits_summary_by_table Table"><code class="literal">table_lock_waits_summary_by_table</code></a>
            table aggregates all table lock wait events, as generated by
            the <code class="literal">wait/lock/table/sql/handler</code>
            instrument. The grouping is by table.
          </p><p>
            This table contains information about internal and external
            locks:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                An internal lock corresponds to a lock in the SQL layer.
                This is currently implemented by a call to
                <code class="literal">thr_lock()</code>. In event rows, these
                locks are distinguished by the
                <code class="literal">OPERATION</code> column, which has one of
                these values:
              </p><pre data-lang="none" class="programlisting">
read normal
read with shared locks
read high priority
read no insert
write allow write
write concurrent insert
write delayed
write low priority
write normal
</pre></li><li class="listitem"><p>
                An external lock corresponds to a lock in the storage
                engine layer. This is currently implemented by a call to
                <code class="literal">handler::external_lock()</code>. In event
                rows, these locks are distinguished by the
                <code class="literal">OPERATION</code> column, which has one of
                these values:
              </p><pre data-lang="none" class="programlisting">
read external
write external
</pre></li></ul>
</div>
<p>
            The
            <a class="link" href="performance-schema.html#table-lock-waits-summary-by-table-table" title="25.11.15.7.3 The table_lock_waits_summary_by_table Table"><code class="literal">table_lock_waits_summary_by_table</code></a>
            table has these grouping columns to indicate how the table
            aggregates events: <code class="literal">OBJECT_TYPE</code>,
            <code class="literal">OBJECT_SCHEMA</code>, and
            <code class="literal">OBJECT_NAME</code>. These columns have the same
            meaning as in the
            <a class="link" href="performance-schema.html#events-waits-current-table" title="25.11.4.1 The events_waits_current Table"><code class="literal">events_waits_current</code></a> table.
            They identify the table to which the row applies.
          </p><p>
            <a class="link" href="performance-schema.html#table-lock-waits-summary-by-table-table" title="25.11.15.7.3 The table_lock_waits_summary_by_table Table"><code class="literal">table_lock_waits_summary_by_table</code></a>
            has the following summary columns containing aggregated
            values. As indicated in the column descriptions, some
            columns are more general and have values that are the same
            as the sum of the values of more fine-grained columns. For
            example, columns that aggregate all locks hold the sum of
            the corresponding columns that aggregate read and write
            locks. In this way, aggregations at higher levels are
            available directly without the need for user-defined views
            that sum lower-level columns.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                <code class="literal">COUNT_STAR</code>,
                <code class="literal">SUM_TIMER_WAIT</code>,
                <code class="literal">MIN_TIMER_WAIT</code>,
                <code class="literal">AVG_TIMER_WAIT</code>,
                <code class="literal">MAX_TIMER_WAIT</code>
              </p><p>
                These columns aggregate all lock operations. They are
                the same as the sum of the corresponding
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_READ</code>
                and
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_WRITE</code>
                columns.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_READ</code>,
                <code class="literal">SUM_TIMER_READ</code>,
                <code class="literal">MIN_TIMER_READ</code>,
                <code class="literal">AVG_TIMER_READ</code>,
                <code class="literal">MAX_TIMER_READ</code>
              </p><p>
                These columns aggregate all read-lock operations. They
                are the same as the sum of the corresponding
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_READ_NORMAL</code>,
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_READ_WITH_SHARED_LOCKS</code>,
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_READ_HIGH_PRIORITY</code>,
                and
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_READ_NO_INSERT</code>
                columns.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_WRITE</code>,
                <code class="literal">SUM_TIMER_WRITE</code>,
                <code class="literal">MIN_TIMER_WRITE</code>,
                <code class="literal">AVG_TIMER_WRITE</code>,
                <code class="literal">MAX_TIMER_WRITE</code>
              </p><p>
                These columns aggregate all write-lock operations. They
                are the same as the sum of the corresponding
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_WRITE_ALLOW_WRITE</code>,
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_WRITE_CONCURRENT_INSERT</code>,
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_WRITE_LOW_PRIORITY</code>,
                and
                <code class="literal"><em class="replaceable"><code>xxx</code></em>_WRITE_NORMAL</code>
                columns.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_READ_NORMAL</code>,
                <code class="literal">SUM_TIMER_READ_NORMAL</code>,
                <code class="literal">MIN_TIMER_READ_NORMAL</code>,
                <code class="literal">AVG_TIMER_READ_NORMAL</code>,
                <code class="literal">MAX_TIMER_READ_NORMAL</code>
              </p><p>
                These columns aggregate internal read locks.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_READ_WITH_SHARED_LOCKS</code>,
                <code class="literal">SUM_TIMER_READ_WITH_SHARED_LOCKS</code>,
                <code class="literal">MIN_TIMER_READ_WITH_SHARED_LOCKS</code>,
                <code class="literal">AVG_TIMER_READ_WITH_SHARED_LOCKS</code>,
                <code class="literal">MAX_TIMER_READ_WITH_SHARED_LOCKS</code>
              </p><p>
                These columns aggregate internal read locks.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_READ_HIGH_PRIORITY</code>,
                <code class="literal">SUM_TIMER_READ_HIGH_PRIORITY</code>,
                <code class="literal">MIN_TIMER_READ_HIGH_PRIORITY</code>,
                <code class="literal">AVG_TIMER_READ_HIGH_PRIORITY</code>,
                <code class="literal">MAX_TIMER_READ_HIGH_PRIORITY</code>
              </p><p>
                These columns aggregate internal read locks.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_READ_NO_INSERT</code>,
                <code class="literal">SUM_TIMER_READ_NO_INSERT</code>,
                <code class="literal">MIN_TIMER_READ_NO_INSERT</code>,
                <code class="literal">AVG_TIMER_READ_NO_INSERT</code>,
                <code class="literal">MAX_TIMER_READ_NO_INSERT</code>
              </p><p>
                These columns aggregate internal read locks.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_READ_EXTERNAL</code>,
                <code class="literal">SUM_TIMER_READ_EXTERNAL</code>,
                <code class="literal">MIN_TIMER_READ_EXTERNAL</code>,
                <code class="literal">AVG_TIMER_READ_EXTERNAL</code>,
                <code class="literal">MAX_TIMER_READ_EXTERNAL</code>
              </p><p>
                These columns aggregate external read locks.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_WRITE_ALLOW_WRITE</code>,
                <code class="literal">SUM_TIMER_WRITE_ALLOW_WRITE</code>,
                <code class="literal">MIN_TIMER_WRITE_ALLOW_WRITE</code>,
                <code class="literal">AVG_TIMER_WRITE_ALLOW_WRITE</code>,
                <code class="literal">MAX_TIMER_WRITE_ALLOW_WRITE</code>
              </p><p>
                These columns aggregate internal write locks.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_WRITE_CONCURRENT_INSERT</code>,
                <code class="literal">SUM_TIMER_WRITE_CONCURRENT_INSERT</code>,
                <code class="literal">MIN_TIMER_WRITE_CONCURRENT_INSERT</code>,
                <code class="literal">AVG_TIMER_WRITE_CONCURRENT_INSERT</code>,
                <code class="literal">MAX_TIMER_WRITE_CONCURRENT_INSERT</code>
              </p><p>
                These columns aggregate internal write locks.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_WRITE_LOW_PRIORITY</code>,
                <code class="literal">SUM_TIMER_WRITE_LOW_PRIORITY</code>,
                <code class="literal">MIN_TIMER_WRITE_LOW_PRIORITY</code>,
                <code class="literal">AVG_TIMER_WRITE_LOW_PRIORITY</code>,
                <code class="literal">MAX_TIMER_WRITE_LOW_PRIORITY</code>
              </p><p>
                These columns aggregate internal write locks.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_WRITE_NORMAL</code>,
                <code class="literal">SUM_TIMER_WRITE_NORMAL</code>,
                <code class="literal">MIN_TIMER_WRITE_NORMAL</code>,
                <code class="literal">AVG_TIMER_WRITE_NORMAL</code>,
                <code class="literal">MAX_TIMER_WRITE_NORMAL</code>
              </p><p>
                These columns aggregate internal write locks.
              </p></li><li class="listitem"><p>
                <code class="literal">COUNT_WRITE_EXTERNAL</code>,
                <code class="literal">SUM_TIMER_WRITE_EXTERNAL</code>,
                <code class="literal">MIN_TIMER_WRITE_EXTERNAL</code>,
                <code class="literal">AVG_TIMER_WRITE_EXTERNAL</code>,
                <code class="literal">MAX_TIMER_WRITE_EXTERNAL</code>
              </p><p>
                These columns aggregate external write locks.
</p></li></ul>
</div>
<p>
            <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted
            for table lock summary tables. It resets the summary columns
            to zero rather than removing rows.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="socket-summary-tables"></a>25.11.15.8 Socket Summary Tables</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684626797664"></a><a class="indexterm" name="idm139684626796160"></a><a class="indexterm" name="idm139684626794656"></a><a class="indexterm" name="idm139684626793152"></a><p>
          These socket summary tables aggregate timer and byte count
          information for socket operations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_event_name</code></a>:
              Aggregate timer and byte count statistics generated by the
              <code class="literal">wait/io/socket/*</code> instruments for all
              socket I/O operations, per socket instrument.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_instance</code></a>:
              Aggregate timer and byte count statistics generated by the
              <code class="literal">wait/io/socket/*</code> instruments for all
              socket I/O operations, per socket instance. When a
              connection terminates, the row in
              <a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_instance</code></a>
              corresponding to it is deleted.
</p></li></ul>
</div>
<p>
          The socket summary tables do not aggregate waits generated by
          <code class="literal">idle</code> events while sockets are waiting for
          the next request from the client. For <code class="literal">idle</code>
          event aggregations, use the wait-event summary tables; see
          <a class="xref" href="performance-schema.html#wait-summary-tables" title="25.11.15.1 Wait Event Summary Tables">Section 25.11.15.1, “Wait Event Summary Tables”</a>.
        </p><p>
          Each socket summary table has one or more grouping columns to
          indicate how the table aggregates events. Event names refer to
          names of event instruments in the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_event_name</code></a>
              has an <code class="literal">EVENT_NAME</code> column. Each row
              summarizes events for a given event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_instance</code></a>
              has an <code class="literal">OBJECT_INSTANCE_BEGIN</code> column.
              Each row summarizes events for a given object.
</p></li></ul>
</div>
<p>
          Each socket summary table has these summary columns containing
          aggregated values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">COUNT_STAR</code>,
              <code class="literal">SUM_TIMER_WAIT</code>,
              <code class="literal">MIN_TIMER_WAIT</code>,
              <code class="literal">AVG_TIMER_WAIT</code>,
              <code class="literal">MAX_TIMER_WAIT</code>
            </p><p>
              These columns aggregate all operations.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_READ</code>,
              <code class="literal">SUM_TIMER_READ</code>,
              <code class="literal">MIN_TIMER_READ</code>,
              <code class="literal">AVG_TIMER_READ</code>,
              <code class="literal">MAX_TIMER_READ</code>,
              <code class="literal">SUM_NUMBER_OF_BYTES_READ</code>
            </p><p>
              These columns aggregate all receive operations
              (<code class="literal">RECV</code>, <code class="literal">RECVFROM</code>, and
              <code class="literal">RECVMSG</code>).
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_WRITE</code>,
              <code class="literal">SUM_TIMER_WRITE</code>,
              <code class="literal">MIN_TIMER_WRITE</code>,
              <code class="literal">AVG_TIMER_WRITE</code>,
              <code class="literal">MAX_TIMER_WRITE</code>,
              <code class="literal">SUM_NUMBER_OF_BYTES_WRITE</code>
            </p><p>
              These columns aggregate all send operations
              (<code class="literal">SEND</code>, <code class="literal">SENDTO</code>, and
              <code class="literal">SENDMSG</code>).
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_MISC</code>,
              <code class="literal">SUM_TIMER_MISC</code>,
              <code class="literal">MIN_TIMER_MISC</code>,
              <code class="literal">AVG_TIMER_MISC</code>,
              <code class="literal">MAX_TIMER_MISC</code>
            </p><p>
              These columns aggregate all other socket operations, such
              as <code class="literal">CONNECT</code>, <code class="literal">LISTEN</code>,
              <code class="literal">ACCEPT</code>, <code class="literal">CLOSE</code>, and
              <code class="literal">SHUTDOWN</code>. There are no byte counts for
              these operations.
</p></li></ul>
</div>
<p>
          The <a class="link" href="performance-schema.html#socket-summary-tables" title="25.11.15.8 Socket Summary Tables"><code class="literal">socket_summary_by_instance</code></a>
          table also has an <code class="literal">EVENT_NAME</code> column that
          indicates the class of the socket:
          <code class="literal">client_connection</code>,
          <code class="literal">server_tcpip_socket</code>,
          <code class="literal">server_unix_socket</code>. This column can be
          grouped on to isolate, for example, client activity from that
          of the server listening sockets.
        </p><p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          socket summary tables. Except for
          <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>,
          tt resets the summary columns to zero rather than removing
          rows.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="memory-summary-tables"></a>25.11.15.9 Memory Summary Tables</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684626734560"></a><a class="indexterm" name="idm139684626733040"></a><a class="indexterm" name="idm139684626731520"></a><a class="indexterm" name="idm139684626730000"></a><a class="indexterm" name="idm139684626728480"></a><a class="indexterm" name="idm139684626726960"></a><a class="indexterm" name="idm139684626725440"></a><a class="indexterm" name="idm139684626723920"></a><a class="indexterm" name="idm139684626722400"></a><a class="indexterm" name="idm139684626720880"></a><p>
          The Performance Schema instruments memory usage and aggregates
          memory usage statistics, detailed by these factors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Type of memory used (various caches, internal buffers, and
              so forth)
            </p></li><li class="listitem"><p>
              Thread, account, user, host indirectly performing the
              memory operation
</p></li></ul>
</div>
<p>
          The Performance Schema instruments the following aspects of
          memory use
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Memory sizes used
            </p></li><li class="listitem"><p>
              Operation counts
            </p></li><li class="listitem"><p>
              Low and high water marks
</p></li></ul>
</div>
<p>
          Memory sizes help to understand or tune the memory consumption
          of the server.
        </p><p>
          Operation counts help to understand or tune the overall
          pressure the server is putting on the memory allocator, which
          has an impact on performance. Allocating a single byte one
          million times is not the same as allocating one million bytes
          a single time; tracking both sizes and counts can expose the
          difference.
        </p><p>
          Low and high water marks are critical to detect workload
          spikes, overall workload stability, and possible memory leaks.
        </p><p>
          Memory summary tables do not contain timing information
          because memory events are not timed.
        </p><p>
          For information about collecting memory usage data, see
          <a class="xref" href="performance-schema.html#memory-instrumentation-behavior" title="Memory Instrumentation Behavior">Memory Instrumentation Behavior</a>.
        </p><p>
          Example memory event summary information:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM memory_summary_global_by_event_name</code></strong>
       <strong class="userinput"><code>WHERE EVENT_NAME = 'memory/sql/TABLE'\G</code></strong>
*************************** 1. row ***************************
                  EVENT_NAME: memory/sql/TABLE
                 COUNT_ALLOC: 1381
                  COUNT_FREE: 924
   SUM_NUMBER_OF_BYTES_ALLOC: 2059873
    SUM_NUMBER_OF_BYTES_FREE: 1407432
              LOW_COUNT_USED: 0
          CURRENT_COUNT_USED: 457
             HIGH_COUNT_USED: 461
    LOW_NUMBER_OF_BYTES_USED: 0
CURRENT_NUMBER_OF_BYTES_USED: 652441
   HIGH_NUMBER_OF_BYTES_USED: 669269
</pre><p>
          Each memory summary table has one or more grouping columns to
          indicate how the table aggregates events. Event names refer to
          names of event instruments in the
          <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_account_by_event_name</code></a>
              has <code class="literal">USER</code>, <code class="literal">HOST</code>, and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given account (user and host combination) and
              event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_host_by_event_name</code></a>
              has <code class="literal">HOST</code> and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given host and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_thread_by_event_name</code></a>
              has <code class="literal">THREAD_ID</code> and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given thread and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_user_by_event_name</code></a>
              has <code class="literal">USER</code> and
              <code class="literal">EVENT_NAME</code> columns. Each row summarizes
              events for a given user and event name.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_global_by_event_name</code></a>
              has an <code class="literal">EVENT_NAME</code> column. Each row
              summarizes events for a given event name.
</p></li></ul>
</div>
<p>
          Each memory summary table has these summary columns containing
          aggregated values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">COUNT_ALLOC</code>,
              <code class="literal">COUNT_FREE</code>
            </p><p>
              The aggregated numbers of calls to memory-allocation and
              memory-free functions.
            </p></li><li class="listitem"><p>
              <code class="literal">SUM_NUMBER_OF_BYTES_ALLOC</code>,
              <code class="literal">SUM_NUMBER_OF_BYTES_FREE</code>
            </p><p>
              The aggregated sizes of allocated and freed memory blocks.
            </p></li><li class="listitem"><p>
              <code class="literal">CURRENT_COUNT_USED</code>
            </p><p>
              The aggregated number of currently allocated blocks that
              have not been freed yet. This is a convenience column,
              equal to <code class="literal">COUNT_ALLOC</code> −
              <code class="literal">COUNT_FREE</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">CURRENT_NUMBER_OF_BYTES_USED</code>
            </p><p>
              The aggregated size of currently allocated memory blocks
              that have not been freed yet. This is a convenience
              column, equal to
              <code class="literal">SUM_NUMBER_OF_BYTES_ALLOC</code> −
              <code class="literal">SUM_NUMBER_OF_BYTES_FREE</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">LOW_COUNT_USED</code>,
              <code class="literal">HIGH_COUNT_USED</code>
            </p><p>
              The low and high water marks corresponding to the
              <code class="literal">CURRENT_COUNT_USED</code> column.
            </p></li><li class="listitem"><p>
              <code class="literal">LOW_NUMBER_OF_BYTES_USED</code>,
              <code class="literal">HIGH_NUMBER_OF_BYTES_USED</code>
            </p><p>
              The low and high water marks corresponding to the
              <code class="literal">CURRENT_NUMBER_OF_BYTES_USED</code> column.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is permitted for
          memory summary tables. It has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              In general, truncation resets the baseline for statistics,
              but does not change the server state. That is, truncating
              a memory table does not free memory.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_ALLOC</code> and
              <code class="literal">COUNT_FREE</code> are reset to a new baseline,
              by reducing each counter by the same value.
            </p></li><li class="listitem"><p>
              Likewise, <code class="literal">SUM_NUMBER_OF_BYTES_ALLOC</code> and
              <code class="literal">SUM_NUMBER_OF_BYTES_FREE</code> are reset to a
              new baseline.
            </p></li><li class="listitem"><p>
              <code class="literal">LOW_COUNT_USED</code> and
              <code class="literal">HIGH_COUNT_USED</code> are reset to
              <code class="literal">CURRENT_COUNT_USED</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">LOW_NUMBER_OF_BYTES_USED</code> and
              <code class="literal">HIGH_NUMBER_OF_BYTES_USED</code> are reset to
              <code class="literal">CURRENT_NUMBER_OF_BYTES_USED</code>.
</p></li></ul>
</div>
<p>
          In addition, each memory summary table that is aggregated by
          account, host, user, or thread is implicitly truncated by
          truncation of the connection table on which it depends, or
          truncation of
          <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_global_by_event_name</code></a>.
          For details, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-tables" title="25.11.8 Performance Schema Connection Tables">Section 25.11.8, “Performance Schema Connection Tables”</a>.
</p>
<div class="simplesect">

<div class="titlepage">
<div>

<div class="simple">
<h5 class="title"><a name="memory-instrumentation-behavior"></a>Memory Instrumentation Behavior</h5>
</div>
</div>
</div>
<p>
            Memory instruments are listed in the
            <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table and
            have names of the form
            <code class="literal">memory/<em class="replaceable"><code>code_area</code></em>/<em class="replaceable"><code>instrument_name</code></em></code>.
            Most memory instrumentation is disabled by default.
          </p><p>
            Instruments named with the prefix
            <code class="literal">memory/performance_schema/</code> expose how
            much memory is allocated for internal buffers in the
            Performance Schema itself. The
            <code class="literal">memory/performance_schema/</code> instruments
            are built in, always enabled, and cannot be disabled at
            startup or runtime. Built-in memory instruments are
            displayed only in the
            <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_global_by_event_name</code></a>
            table.
          </p><p>
            To control memory instrumention state at server startup, use
            lines like these in your <code class="filename">my.cnf</code> file:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                Enable:
              </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='memory/%=ON'
</pre></li><li class="listitem"><p>
                Disable:
              </p><pre data-lang="ini" class="programlisting">
[mysqld]
performance-schema-instrument='memory/%=OFF'
</pre></li></ul>
</div>
<p>
            To control memory instrumention state at runtime, update the
            <code class="literal">ENABLED</code> column of the relevant
            instruments in the
            <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                Enable:
              </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'YES'
WHERE NAME LIKE 'memory/%';
</pre></li><li class="listitem"><p>
                Disable:
              </p><pre data-lang="sql" class="programlisting">
UPDATE setup_instruments SET ENABLED = 'NO'
WHERE NAME LIKE 'memory/%';
</pre></li></ul>
</div>
<p>
            For memory instruments, the <code class="literal">TIMED</code> column
            in <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> is ignored
            because memory operations are not timed.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">

<div class="admon-title">
Note
</div>
<p>
              If disabled memory instrumentation is later enabled,
              accounting may result in an apparently negative allocation
              from missing an allocation operation but counting a free
              operation.
</p>
</div>
<p>
            When a thread in the server executes a memory allocation
            that has been instrumented, these rules apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                If the thread is not instrumented or the memory
                instrument is not enabled, the memory block allocated is
                not instrumented.
              </p></li><li class="listitem"><p>
                Otherwise (that is, both the thread and the instrument
                are enabled), the memory block allocated is
                instrumented.
</p></li></ul>
</div>
<p>
            For deallocation, these rules apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                If a thread is instrumented, and a memory block is not
                instrumented, the free operation is not instrumented; no
                statistics are changed.
              </p></li><li class="listitem"><p>
                If a thread is not instrumented, and a memory block is
                instrumented, the free operation is instrumented, and
                statistics are changed.
</p></li></ul>
</div>
<p>
            For the per-thread statistics, the following rules apply.
          </p><p>
            When an instrumented memory block of size
            <em class="replaceable"><code>N</code></em> is allocated, the Performance
            Schema makes these updates to memory summary table columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                <code class="literal">COUNT_ALLOC</code>: Increased by 1
              </p></li><li class="listitem"><p>
                <code class="literal">CURRENT_COUNT_USED</code>: Increased by 1
              </p></li><li class="listitem"><p>
                <code class="literal">HIGH_COUNT_USED</code>: Increased if
                <code class="literal">CURRENT_COUNT_USED</code> is a new maximum
              </p></li><li class="listitem"><p>
                <code class="literal">SUM_NUMBER_OF_BYTES_ALLOC</code>: Increased
                by <em class="replaceable"><code>N</code></em>
              </p></li><li class="listitem"><p>
                <code class="literal">CURRENT_NUMBER_OF_BYTES_USED</code>:
                Increased by <em class="replaceable"><code>N</code></em>
              </p></li><li class="listitem"><p>
                <code class="literal">HIGH_NUMBER_OF_BYTES_USED</code>: Increased
                if <code class="literal">CURRENT_NUMBER_OF_BYTES_USED</code> is a
                new maximum
</p></li></ul>
</div>
<p>
            When an instrumented memory block is deallocated, the
            Performance Schema makes these updates to memory summary
            table columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                <code class="literal">COUNT_FREE</code>: Increased by 1
              </p></li><li class="listitem"><p>
                <code class="literal">CURRENT_COUNT_USED</code>: Decreased by 1
              </p></li><li class="listitem"><p>
                <code class="literal">LOW_COUNT_USED</code>: Decreased if
                <code class="literal">CURRENT_COUNT_USED</code> is a new minimum
              </p></li><li class="listitem"><p>
                <code class="literal">SUM_NUMBER_OF_BYTES_FREE</code>: Increased
                by <em class="replaceable"><code>N</code></em>
              </p></li><li class="listitem"><p>
                <code class="literal">CURRENT_NUMBER_OF_BYTES_USED</code>:
                Decreased by <em class="replaceable"><code>N</code></em>
              </p></li><li class="listitem"><p>
                <code class="literal">LOW_NUMBER_OF_BYTES_USED</code>: Decreased
                if <code class="literal">CURRENT_NUMBER_OF_BYTES_USED</code> is a
                new minimum
</p></li></ul>
</div>
<p>
            For higher-level aggregates (global, by account, by user, by
            host), the same rules apply as expected for low and high
            water marks.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                <code class="literal">LOW_COUNT_USED</code> and
                <code class="literal">LOW_NUMBER_OF_BYTES_USED</code> are lower
                estimates. The value reported by the Performance Schema
                is guaranteed to be less than or equal to the lowest
                count or size of memory effectively used at runtime.
              </p></li><li class="listitem"><p>
                <code class="literal">HIGH_COUNT_USED</code> and
                <code class="literal">HIGH_NUMBER_OF_BYTES_USED</code> are higher
                estimates. The value reported by the Performance Schema
                is guaranteed to be greater than or equal to the highest
                count or size of memory effectively used at runtime.
</p></li></ul>
</div>
<p>
            For lower estimates in summary tables other than
            <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_global_by_event_name</code></a>,
            it is possible for values to go negative if memory ownership
            is transferred between threads.
          </p><p>
            Here is an example of estimate computation; but note that
            estimate implementation is subject to change:
          </p><p>
            Thread 1 uses memory in the range from 1MB to 2MB during
            execution, as reported by the
            <code class="literal">LOW_NUMBER_OF_BYTES_USED</code> and
            <code class="literal">HIGH_NUMBER_OF_BYTES_USED</code> columns of the
            <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_by_thread_by_event_name</code></a>
            table.
          </p><p>
            Thread 2 uses memory in the range from 10MB to 12MB during
            execution, as reported likewise.
          </p><p>
            When these two threads belong to the same user account, the
            per-account summary estimates that this account used memory
            in the range from 11MB to 14MB. That is, the
            <code class="literal">LOW_NUMBER_OF_BYTES_USED</code> for the higher
            level aggregate is the sum of each
            <code class="literal">LOW_NUMBER_OF_BYTES_USED</code> (assuming the
            worst case). Likewise, the
            <code class="literal">HIGH_NUMBER_OF_BYTES_USED</code> for the higher
            level aggregate is the sum of each
            <code class="literal">HIGH_NUMBER_OF_BYTES_USED</code> (assuming the
            worst case).
          </p><p>
            11MB is a lower estimate that can occur only if both threads
            hit the low usage mark at the same time.
          </p><p>
            14MB is a higher estimate that can occur only if both
            threads hit the high usage mark at the same time.
          </p><p>
            The real memory usage for this account could have been in
            the range from 11.5MB to 13.5MB.
          </p><p>
            For capacity planning, reporting the worst case is actually
            the desired behavior, as it shows what can potentially
            happen when sessions are uncorrelated, which is typically
            the case.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="performance-schema-status-variable-summary-tables"></a>25.11.15.10 Status Variable Summary Tables</h4>

</div>

</div>

</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
            The value of the
            <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56</code></a>
            system variable affects the information available from the
            tables described here. For details, see the description of
            that variable in <a class="xref" href="server-administration.html#server-system-variables" title="5.1.7 Server System Variables">Section 5.1.7, “Server System Variables”</a>.
</p>
</div>
<p>
          The Performance Schema makes status variable information
          available in the tables described in
          <a class="xref" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables">Section 25.11.14, “Performance Schema Status Variable Tables”</a>.
          It also makes aggregated status variable information available
          in summary tables, described here. Each status variable
          summary table has one or more grouping columns to indicate how
          the table aggregates status values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_account</code></a> has
              <code class="literal">USER</code>, <code class="literal">HOST</code>, and
              <code class="literal">VARIABLE_NAME</code> columns to summarize
              status variables by account.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_host</code></a> has
              <code class="literal">HOST</code> and
              <code class="literal">VARIABLE_NAME</code> columns to summarize
              status variables by the host from which clients connected.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_user</code></a> has
              <code class="literal">USER</code> and
              <code class="literal">VARIABLE_NAME</code> columns to summarize
              status variables by client user name.
</p></li></ul>
</div>
<p>
          Each status variable summary table has this summary column
          containing aggregated values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">VARIABLE_VALUE</code>
            </p><p>
              The aggregated status variable value for active and
              terminated sessions.
</p></li></ul>
</div>
<p>
          The meaning of <span class="quote">“<span class="quote">account</span>”</span> in these tables is
          similar to its meaning in the MySQL grant tables in the
          <code class="literal">mysql</code> system database, in the sense that
          the term refers to a combination of user and host values. They
          differ in that, for grant tables, the host part of an account
          can be a pattern, whereas for Performance Schema tables, the
          host value is always a specific nonpattern host name.
        </p><p>
          Account status is collected when sessions terminate. The
          session status counters are added to the global status
          counters and the corresponding account status counters. If
          account statistics are not collected, the session status is
          added to host and user status, if host and user status are
          collected.
        </p><p>
          Account, host, and user statistics are not collected if the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_accounts_size"><code class="literal">performance_schema_accounts_size</code></a>,
          <a class="link" href="performance-schema.html#sysvar_performance_schema_hosts_size"><code class="literal">performance_schema_hosts_size</code></a>,
          and
          <a class="link" href="performance-schema.html#sysvar_performance_schema_users_size"><code class="literal">performance_schema_users_size</code></a>
          system variables, respectively, are set to 0.
        </p><p>
          The Performance Schema supports <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE
          TABLE</code></a> for status variable summary tables as follows;
          in all cases, status for active sessions is unaffected:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_account</code></a>: Aggregates
              account status from terminated sessions to user and host
              status, then resets account status.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_host</code></a>: Resets
              aggregated host status from terminated sessions.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_user</code></a>: Resets
              aggregated user status from terminated sessions.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#flush-status"><code class="literal">FLUSH STATUS</code></a> adds the session
          status from all active sessions to the global status
          variables, resets the status of all active sessions, and
          resets account, host, and user status values aggregated from
          disconnected sessions.
</p>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-miscellaneous-tables"></a>25.11.16 Performance Schema Miscellaneous Tables</h3>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#host-cache-table">25.11.16.1 The host_cache Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#performance-timers-table">25.11.16.2 The performance_timers Table</a></span></dt><dt><span class="section"><a href="performance-schema.html#threads-table">25.11.16.3 The threads Table</a></span></dt></dl>
</div>
<p>
        The following sections describe tables that do not fall into the
        table categories discussed in the preceding sections:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
            <a class="link" href="performance-schema.html#host-cache-table" title="25.11.16.1 The host_cache Table"><code class="literal">host_cache</code></a>: Information from
            the internal host cache
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a>: Which event
            timers are available
          </p></li><li class="listitem"><p>
            <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a>: Information about
            server threads
</p></li></ul>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="host-cache-table"></a>25.11.16.1 The host_cache Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684626529936"></a><a class="indexterm" name="idm139684626528448"></a><p>
          The <a class="link" href="performance-schema.html#host-cache-table" title="25.11.16.1 The host_cache Table"><code class="literal">host_cache</code></a> table provides
          access to the contents of the host cache, which contains
          client host name and IP address information and is used to
          avoid DNS lookups. (See <a class="xref" href="optimization.html#host-cache" title="8.12.5.2 DNS Lookup Optimization and the Host Cache">Section 8.12.5.2, “DNS Lookup Optimization and the Host Cache”</a>.) The
          <a class="link" href="performance-schema.html#host-cache-table" title="25.11.16.1 The host_cache Table"><code class="literal">host_cache</code></a> table exposes the
          contents of the host cache so that it can be examined using
          <a class="link" href="sql-syntax.html#select" title="13.2.9 SELECT Syntax"><code class="literal">SELECT</code></a> statements. The
          Performance Schema must be enabled or this table is empty.
        </p><p>
          The <a class="link" href="performance-schema.html#host-cache-table" title="25.11.16.1 The host_cache Table"><code class="literal">host_cache</code></a> table has these
          columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">IP</code>
            </p><p>
              The IP address of the client that connected to the server,
              expressed as a string.
            </p></li><li class="listitem"><p>
              <code class="literal">HOST</code>
            </p><p>
              The resolved DNS host name for that client IP, or
              <code class="literal">NULL</code> if the name is unknown.
            </p></li><li class="listitem"><p>
              <code class="literal">HOST_VALIDATED</code>
            </p><p>
              Whether the IP-to-host name-to-IP DNS resolution was
              performed successfully for the client IP. If
              <code class="literal">HOST_VALIDATED</code> is
              <code class="literal">YES</code>, the <code class="literal">HOST</code> column
              is used as the host name corresponding to the IP so that
              calls to DNS can be avoided. While
              <code class="literal">HOST_VALIDATED</code> is
              <code class="literal">NO</code>, DNS resolution is attempted again
              for each connection attempt, until it eventually completes
              with either a valid result or a permanent error. This
              information enables the server to avoid caching bad or
              missing host names during temporary DNS failures, which
              would affect clients forever.
            </p></li><li class="listitem"><p>
              <code class="literal">SUM_CONNECT_ERRORS</code>
            </p><p>
              The number of connection errors that are deemed
              <span class="quote">“<span class="quote">blocking</span>”</span> (assessed against the
              <a class="link" href="server-administration.html#sysvar_max_connect_errors"><code class="literal">max_connect_errors</code></a> system
              variable). Only protocol handshake errors are counted, and
              only for hosts that passed validation
              (<code class="literal">HOST_VALIDATED = YES</code>).
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_HOST_BLOCKED_ERRORS</code>
            </p><p>
              The number of connections that were blocked because
              <code class="literal">SUM_CONNECT_ERRORS</code> exceeded the value
              of the <a class="link" href="server-administration.html#sysvar_max_connect_errors"><code class="literal">max_connect_errors</code></a>
              system variable.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_NAMEINFO_TRANSIENT_ERRORS</code>
            </p><p>
              The number of transient errors during IP-to-host name DNS
              resolution.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_NAMEINFO_PERMANENT_ERRORS</code>
            </p><p>
              The number of permanent errors during IP-to-host name DNS
              resolution.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_FORMAT_ERRORS</code>
            </p><p>
              The number of host name format errors. MySQL does not
              perform matching of <code class="literal">Host</code> column values
              in the <code class="literal">mysql.user</code> table against host
              names for which one or more of the initial components of
              the name are entirely numeric, such as
              <code class="literal">1.2.example.com</code>. The client IP address
              is used instead. For the rationale why this type of
              matching does not occur, see
              <a class="xref" href="security.html#account-names" title="6.2.3 Specifying Account Names">Section 6.2.3, “Specifying Account Names”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_ADDRINFO_TRANSIENT_ERRORS</code>
            </p><p>
              The number of transient errors during host name-to-IP
              reverse DNS resolution.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_ADDRINFO_PERMANENT_ERRORS</code>
            </p><p>
              The number of permanent errors during host name-to-IP
              reverse DNS resolution.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_FCRDNS_ERRORS</code>
            </p><p>
              The number of forward-confirmed reverse DNS errors. These
              errors occur when IP-to-host name-to-IP DNS resolution
              produces an IP address that does not match the client
              originating IP address.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_HOST_ACL_ERRORS</code>
            </p><p>
              The number of errors that occur because no users are
              permitted to connect from the client host. In such cases,
              the server returns
              <a class="link" href="error-handling.html#error_er_host_not_privileged"><code class="literal">ER_HOST_NOT_PRIVILEGED</code></a> and
              does not even ask for a user name or password.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_NO_AUTH_PLUGIN_ERRORS</code>
            </p><p>
              The number of errors due to requests for an unavailable
              authentication plugin. A plugin can be unavailable if, for
              example, it was never loaded or a load attempt failed.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_AUTH_PLUGIN_ERRORS</code>
            </p><p>
              The number of errors reported by authentication plugins.
            </p><p>
              An authentication plugin can report different error codes
              to indicate the root cause of a failure. Depending on the
              type of error, one of these columns is incremented:
              <code class="literal">COUNT_AUTHENTICATION_ERRORS</code>,
              <code class="literal">COUNT_AUTH_PLUGIN_ERRORS</code>,
              <code class="literal">COUNT_HANDSHAKE_ERRORS</code>. New return
              codes are an optional extension to the existing plugin
              API. Unknown or unexpected plugin errors are counted in
              the <code class="literal">COUNT_AUTH_PLUGIN_ERRORS</code> column.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_HANDSHAKE_ERRORS</code>
            </p><p>
              The number of errors detected at the wire protocol level.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_PROXY_USER_ERRORS</code>
            </p><p>
              The number of errors detected when proxy user A is proxied
              to another user B who does not exist.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_PROXY_USER_ACL_ERRORS</code>
            </p><p>
              The number of errors detected when proxy user A is proxied
              to another user B who does exist but for whom A does not
              have the <a class="link" href="security.html#priv_proxy"><code class="literal">PROXY</code></a> privilege.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_AUTHENTICATION_ERRORS</code>
            </p><p>
              The number of errors caused by failed authentication.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_SSL_ERRORS</code>
            </p><p>
              The number of errors due to SSL problems.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_MAX_USER_CONNECTIONS_ERRORS</code>
            </p><p>
              The number of errors caused by exceeding per-user
              connection quotas. See <a class="xref" href="security.html#user-resources" title="6.3.5 Setting Account Resource Limits">Section 6.3.5, “Setting Account Resource Limits”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS</code>
            </p><p>
              The number of errors caused by exceeding per-user
              connections-per-hour quotas. See
              <a class="xref" href="security.html#user-resources" title="6.3.5 Setting Account Resource Limits">Section 6.3.5, “Setting Account Resource Limits”</a>.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_DEFAULT_DATABASE_ERRORS</code>
            </p><p>
              The number of errors related to the default database. For
              example, the database did not exist or the user had no
              privileges for accessing it.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_INIT_CONNECT_ERRORS</code>
            </p><p>
              The number of errors caused by execution failures of
              statements in the
              <a class="link" href="server-administration.html#sysvar_init_connect"><code class="literal">init_connect</code></a> system
              variable value.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_LOCAL_ERRORS</code>
            </p><p>
              The number of errors local to the server implementation
              and not related to the network, authentication, or
              authorization. For example, out-of-memory conditions fall
              into this category.
            </p></li><li class="listitem"><p>
              <code class="literal">COUNT_UNKNOWN_ERRORS</code>
            </p><p>
              The number of other, unknown errors not accounted for by
              other columns in this table. This column is reserved for
              future use, in case new error conditions must be reported,
              and if preserving the backward compatibility and table
              structure of the <a class="link" href="performance-schema.html#host-cache-table" title="25.11.16.1 The host_cache Table"><code class="literal">host_cache</code></a>
              table is required.
            </p></li><li class="listitem"><p>
              <code class="literal">FIRST_SEEN</code>
            </p><p>
              The timestamp of the first connection attempt seen from
              the client in the <code class="literal">IP</code> column.
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_SEEN</code>
            </p><p>
              The timestamp of the last connection attempt seen from the
              client in the <code class="literal">IP</code> column.
            </p></li><li class="listitem"><p>
              <code class="literal">FIRST_ERROR_SEEN</code>
            </p><p>
              The timestamp of the first error seen from the client in
              the <code class="literal">IP</code> column.
            </p></li><li class="listitem"><p>
              <code class="literal">LAST_ERROR_SEEN</code>
            </p><p>
              The timestamp of the last error seen from the client in
              the <code class="literal">IP</code> column.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#flush-hosts"><code class="literal">FLUSH HOSTS</code></a> and
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE
          host_cache</code></a> have the same effect: They clear the host
          cache. Clearing the cache also removes rows from the
          <a class="link" href="performance-schema.html#host-cache-table" title="25.11.16.1 The host_cache Table"><code class="literal">host_cache</code></a> table (because it is
          the visible representation of the cache) and unblocks any
          blocked hosts (see <a class="xref" href="error-handling.html#blocked-host" title="B.5.2.5 Host 'host_name' is blocked">Section B.5.2.5, “Host 'host_name' is blocked”</a>.)
          <a class="link" href="sql-syntax.html#flush-hosts"><code class="literal">FLUSH HOSTS</code></a> requires the
          <a class="link" href="security.html#priv_reload"><code class="literal">RELOAD</code></a> privilege.
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> requires the
          <a class="link" href="security.html#priv_drop"><code class="literal">DROP</code></a> privilege for the
          <a class="link" href="performance-schema.html#host-cache-table" title="25.11.16.1 The host_cache Table"><code class="literal">host_cache</code></a> table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="performance-timers-table"></a>25.11.16.2 The performance_timers Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684626424000"></a><a class="indexterm" name="idm139684626422496"></a><p>
          The <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a> table
          shows which event timers are available:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM performance_timers;</code></strong>
+-------------+-----------------+------------------+----------------+
| TIMER_NAME  | TIMER_FREQUENCY | TIMER_RESOLUTION | TIMER_OVERHEAD |
+-------------+-----------------+------------------+----------------+
| CYCLE       |      2389029850 |                1 |             72 |
| NANOSECOND  |      1000000000 |                1 |            112 |
| MICROSECOND |         1000000 |                1 |            136 |
| MILLISECOND |            1036 |                1 |            168 |
| TICK        |             105 |                1 |           2416 |
+-------------+-----------------+------------------+----------------+
</pre><p>
          If the values associated with a given timer name are
          <code class="literal">NULL</code>, that timer is not supported on your
          platform. The rows that do not contain <code class="literal">NULL</code>
          indicate which timers you can use in
          <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a>. For an explanation
          of how event timing occurs, see
          <a class="xref" href="performance-schema.html#performance-schema-timing" title="25.4.1 Performance Schema Event Timing">Section 25.4.1, “Performance Schema Event Timing”</a>.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">

<div class="admon-title">
Note
</div>
<p>
            As of MySQL 5.7.21, the Performance Schema
            <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table is
            deprecated and is removed in MySQL 8.0, as is the
            <code class="literal">TICKS</code> row in the
            <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a> table.
</p>
</div>
<p>
          The <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a> table has
          these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">TIMER_NAME</code>
            </p><p>
              The name by which to refer to the timer when configuring
              the <a class="link" href="performance-schema.html#setup-timers-table" title="25.11.2.5 The setup_timers Table"><code class="literal">setup_timers</code></a> table.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_FREQUENCY</code>
            </p><p>
              The number of timer units per second. For a cycle timer,
              the frequency is generally related to the CPU speed. For
              example, on a system with a 2.4GHz processor, the
              <code class="literal">CYCLE</code> may be close to 2400000000.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_RESOLUTION</code>
            </p><p>
              Indicates the number of timer units by which timer values
              increase. If a timer has a resolution of 10, its value
              increases by 10 each time.
            </p></li><li class="listitem"><p>
              <code class="literal">TIMER_OVERHEAD</code>
            </p><p>
              The minimal number of cycles of overhead to obtain one
              timing with the given timer. The Performance Schema
              determines this value by invoking the timer 20 times
              during initialization and picking the smallest value. The
              total overhead really is twice this amount because the
              instrumentation invokes the timer at the start and end of
              each event. The timer code is called only for timed
              events, so this overhead does not apply for nontimed
              events.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#performance-timers-table" title="25.11.16.2 The performance_timers Table"><code class="literal">performance_timers</code></a> table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a name="threads-table"></a>25.11.16.3 The threads Table</h4>

</div>

</div>

</div>
<a class="indexterm" name="idm139684626392048"></a><a class="indexterm" name="idm139684626390560"></a><a class="indexterm" name="idm139684626389072"></a><p>
          The <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table contains a row
          for each server thread. Each row contains information about a
          thread and indicates whether monitoring and historical event
          logging are enabled for it:
        </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM threads\G</code></strong>
*************************** 1. row ***************************
          THREAD_ID: 1
               NAME: thread/sql/main
               TYPE: BACKGROUND
     PROCESSLIST_ID: NULL
   PROCESSLIST_USER: NULL
   PROCESSLIST_HOST: NULL
     PROCESSLIST_DB: NULL
PROCESSLIST_COMMAND: NULL
   PROCESSLIST_TIME: 80284
  PROCESSLIST_STATE: NULL
   PROCESSLIST_INFO: NULL
   PARENT_THREAD_ID: NULL
               ROLE: NULL
       INSTRUMENTED: YES
            HISTORY: YES
    CONNECTION_TYPE: NULL
       THREAD_OS_ID: 489803
...
*************************** 4. row ***************************
          THREAD_ID: 51
               NAME: thread/sql/one_connection
               TYPE: FOREGROUND
     PROCESSLIST_ID: 34
   PROCESSLIST_USER: isabella
   PROCESSLIST_HOST: localhost
     PROCESSLIST_DB: performance_schema
PROCESSLIST_COMMAND: Query
   PROCESSLIST_TIME: 0
  PROCESSLIST_STATE: Sending data
   PROCESSLIST_INFO: SELECT * FROM threads
   PARENT_THREAD_ID: 1
               ROLE: NULL
       INSTRUMENTED: YES
            HISTORY: YES
    CONNECTION_TYPE: SSL/TLS
       THREAD_OS_ID: 755399
...
</pre><p>
          When the Performance Schema initializes, it populates the
          <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table based on the
          threads in existence then. Thereafter, a new row is added each
          time the server creates a thread.
        </p><p>
          The <code class="literal">INSTRUMENTED</code> and
          <code class="literal">HISTORY</code> column values for new threads are
          determined by the contents of the
          <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table. For
          information about how to use the
          <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table to control
          these columns, see
          <a class="xref" href="performance-schema.html#performance-schema-thread-filtering" title="25.4.6 Pre-Filtering by Thread">Section 25.4.6, “Pre-Filtering by Thread”</a>.
        </p><a class="indexterm" name="idm139684626375968"></a><p>
          Removal of rows from the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a>
          table occurs when threads end. For a thread associated with a
          client session, removal occurs when the session ends. If a
          client has auto-reconnect enabled and the session reconnects
          after a disconnect, the session becomes associated with a new
          row in the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table that has
          a different <code class="literal">PROCESSLIST_ID</code> value. The
          initial <code class="literal">INSTRUMENTED</code> and
          <code class="literal">HISTORY</code> values for the new thread may be
          different from those of the original thread: The
          <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table may have
          changed in the meantime, and if the
          <code class="literal">INSTRUMENTED</code> or <code class="literal">HISTORY</code>
          value for the original thread was changed after the row was
          initialized, the change does not carry over to the new thread.
        </p><p>
          The <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table columns with
          names having a prefix of <code class="literal">PROCESSLIST_</code>
          provide information similar to that available from the
          <a class="link" href="information-schema.html#processlist-table" title="24.18 The INFORMATION_SCHEMA PROCESSLIST Table"><code class="literal">INFORMATION_SCHEMA.PROCESSLIST</code></a>
          table or the <a class="link" href="sql-syntax.html#show-processlist" title="13.7.5.29 SHOW PROCESSLIST Syntax"><code class="literal">SHOW PROCESSLIST</code></a>
          statement. Thus, all three sources provide thread-monitoring
          information. Use of <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a>
          differs from use of the other two sources in these ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Access to <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> does not
              require a mutex and has minimal impact on server
              performance.
              <a class="link" href="information-schema.html#processlist-table" title="24.18 The INFORMATION_SCHEMA PROCESSLIST Table"><code class="literal">INFORMATION_SCHEMA.PROCESSLIST</code></a>
              and <a class="link" href="sql-syntax.html#show-processlist" title="13.7.5.29 SHOW PROCESSLIST Syntax"><code class="literal">SHOW PROCESSLIST</code></a> have
              negative performance consequences because they require a
              mutex.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> provides additional
              information for each thread, such as whether it is a
              foreground or background thread, and the location within
              the server associated with the thread.
            </p></li><li class="listitem"><p>
              <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> provides information
              about background threads, so it can be used to monitor
              activity the other thread information sources cannot.
            </p></li><li class="listitem"><p>
              You can enable or disable thread monitoring (that is,
              whether events executed by the thread are instrumented)
              and historical event logging. To control the initial
              <code class="literal">INSTRUMENTED</code> and
              <code class="literal">HISTORY</code> values for new foreground
              threads, use the <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a>
              table. To control these aspects of existing threads, set
              the <code class="literal">INSTRUMENTED</code> and
              <code class="literal">HISTORY</code> columns of
              <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table rows. (For more
              information about the conditions under which thread
              monitoring and historical event logging occur, see the
              descriptions of the <code class="literal">INSTRUMENTED</code> and
              <code class="literal">HISTORY</code> columns.)
</p></li></ul>
</div>
<p>
          For these reasons, DBAs who perform server monitoring using
          <a class="link" href="information-schema.html#processlist-table" title="24.18 The INFORMATION_SCHEMA PROCESSLIST Table"><code class="literal">INFORMATION_SCHEMA.PROCESSLIST</code></a> or
          <a class="link" href="sql-syntax.html#show-processlist" title="13.7.5.29 SHOW PROCESSLIST Syntax"><code class="literal">SHOW PROCESSLIST</code></a> may wish to
          monitor using the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table
          instead.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">

<div class="admon-title">
Note
</div>
<p>
            For
            <a class="link" href="information-schema.html#processlist-table" title="24.18 The INFORMATION_SCHEMA PROCESSLIST Table"><code class="literal">INFORMATION_SCHEMA.PROCESSLIST</code></a>
            and <a class="link" href="sql-syntax.html#show-processlist" title="13.7.5.29 SHOW PROCESSLIST Syntax"><code class="literal">SHOW PROCESSLIST</code></a>,
            information about threads for other users is shown only if
            the current user has the
            <a class="link" href="security.html#priv_process"><code class="literal">PROCESS</code></a> privilege. That is
            not true of the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table;
            all rows are shown to any user who has the
            <code class="literal">SELECT</code> privilege for the table. Users who
            should not be able to see threads for other users should not
            be given that privilege.
</p>
</div>
<p>
          The <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table has these
          columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              <code class="literal">THREAD_ID</code>
            </p><p>
              A unique thread identifier.
            </p></li><li class="listitem"><p>
              <code class="literal">NAME</code>
            </p><p>
              The name associated with the thread instrumentation code
              in the server. For example,
              <code class="literal">thread/sql/one_connection</code> corresponds
              to the thread function in the code responsible for
              handling a user connection, and
              <code class="literal">thread/sql/main</code> stands for the
              <code class="literal">main()</code> function of the server.
            </p></li><li class="listitem"><p>
              <code class="literal">TYPE</code>
            </p><p>
              The thread type, either <code class="literal">FOREGROUND</code> or
              <code class="literal">BACKGROUND</code>. User connection threads are
              foreground threads. Threads associated with internal
              server activity are background threads. Examples are
              internal <code class="literal">InnoDB</code> threads, <span class="quote">“<span class="quote">binlog
              dump</span>”</span> threads sending information to slaves, and
              slave I/O and SQL threads.
            </p></li><li class="listitem"><p>
              <code class="literal">PROCESSLIST_ID</code>
            </p><p>
              For threads that are displayed in the
              <a class="link" href="information-schema.html#processlist-table" title="24.18 The INFORMATION_SCHEMA PROCESSLIST Table"><code class="literal">INFORMATION_SCHEMA.PROCESSLIST</code></a>
              table, this is the same value displayed in the
              <code class="literal">ID</code> column of that table. It is also the
              value displayed in the <code class="literal">Id</code> column of
              <a class="link" href="sql-syntax.html#show-processlist" title="13.7.5.29 SHOW PROCESSLIST Syntax"><code class="literal">SHOW PROCESSLIST</code></a> output,
              and the value that
              <a class="link" href="functions.html#function_connection-id"><code class="literal">CONNECTION_ID()</code></a> would
              return within that thread.
            </p><p>
              For background threads (threads not associated with a user
              connection), <code class="literal">PROCESSLIST_ID</code> is
              <code class="literal">NULL</code>, so the values are not unique.
            </p></li><li class="listitem"><p>
              <code class="literal">PROCESSLIST_USER</code>
            </p><p>
              The user associated with a foreground thread,
              <code class="literal">NULL</code> for a background thread.
            </p></li><li class="listitem"><p>
              <code class="literal">PROCESSLIST_HOST</code>
            </p><p>
              The host name of the client associated with a foreground
              thread, <code class="literal">NULL</code> for a background thread.
            </p><p>
              Unlike the <code class="literal">HOST</code> column of the
              <code class="literal">INFORMATION_SCHEMA</code>
              <a class="link" href="information-schema.html#processlist-table" title="24.18 The INFORMATION_SCHEMA PROCESSLIST Table"><code class="literal">PROCESSLIST</code></a> table or the
              <code class="literal">Host</code> column of
              <a class="link" href="sql-syntax.html#show-processlist" title="13.7.5.29 SHOW PROCESSLIST Syntax"><code class="literal">SHOW PROCESSLIST</code></a> output,
              the <code class="literal">PROCESSLIST_HOST</code> column does not
              include the port number for TCP/IP connections. To obtain
              this information from the Performance Schema, enable the
              socket instrumentation (which is not enabled by default)
              and examine the
              <a class="link" href="performance-schema.html#socket-instances-table" title="25.11.3.5 The socket_instances Table"><code class="literal">socket_instances</code></a> table:
            </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM setup_instruments WHERE NAME LIKE 'wait/io/socket%';</code></strong>
+----------------------------------------+---------+-------+
| NAME                                   | ENABLED | TIMED |
+----------------------------------------+---------+-------+
| wait/io/socket/sql/server_tcpip_socket | NO      | NO    |
| wait/io/socket/sql/server_unix_socket  | NO      | NO    |
| wait/io/socket/sql/client_connection   | NO      | NO    |
+----------------------------------------+---------+-------+
3 rows in set (0.01 sec)

mysql&gt; <strong class="userinput"><code>UPDATE setup_instruments SET ENABLED='YES' WHERE NAME LIKE 'wait/io/socket%';</code></strong>
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql&gt; <strong class="userinput"><code>SELECT * FROM socket_instances\G</code></strong>
*************************** 1. row ***************************
           EVENT_NAME: wait/io/socket/sql/client_connection
OBJECT_INSTANCE_BEGIN: 140612577298432
            THREAD_ID: 31
            SOCKET_ID: 53
                   IP: ::ffff:127.0.0.1
                 PORT: 55642
                STATE: ACTIVE
...
</pre></li><li class="listitem"><p>
              <code class="literal">PROCESSLIST_DB</code>
            </p><p>
              The default database for the thread, or
              <code class="literal">NULL</code> if there is none.
            </p></li><li class="listitem"><p>
              <code class="literal">PROCESSLIST_COMMAND</code>
            </p><p>
              For foreground threads, the type of command the thread is
              executing on behalf of the client, or
              <code class="literal">Sleep</code> if the session is idle. For
              descriptions of thread commands, see
              <a class="xref" href="optimization.html#thread-information" title="8.14 Examining Thread Information">Section 8.14, “Examining Thread Information”</a>. The value of this
              column corresponds to the
              <code class="literal">COM_<em class="replaceable"><code>xxx</code></em></code>
              commands of the client/server protocol and
              <code class="literal">Com_<em class="replaceable"><code>xxx</code></em></code>
              status variables. See
              <a class="xref" href="server-administration.html#server-status-variables" title="5.1.9 Server Status Variables">Section 5.1.9, “Server Status Variables”</a>
            </p><p>
              Background threads do not execute commands on behalf of
              clients, so this column may be <code class="literal">NULL</code>.
            </p></li><li class="listitem"><p>
              <code class="literal">PROCESSLIST_TIME</code>
            </p><p>
              The time in seconds that the thread has been in its
              current state.
            </p></li><li class="listitem"><p>
              <code class="literal">PROCESSLIST_STATE</code>
            </p><p>
              An action, event, or state that indicates what the thread
              is doing. For descriptions of
              <code class="literal">PROCESSLIST_STATE</code> values, see
              <a class="xref" href="optimization.html#thread-information" title="8.14 Examining Thread Information">Section 8.14, “Examining Thread Information”</a>. If the value if
              <code class="literal">NULL</code>, the thread may correspond to an
              idle client session or the work it is doing is not
              instrumented with stages.
            </p><p>
              Most states correspond to very quick operations. If a
              thread stays in a given state for many seconds, there
              might be a problem that bears investigation.
            </p></li><li class="listitem"><p>
              <code class="literal">PROCESSLIST_INFO</code>
            </p><p>
              The statement the thread is executing, or
              <code class="literal">NULL</code> if it is not executing any
              statement. The statement might be the one sent to the
              server, or an innermost statement if the statement
              executes other statements. For example, if a
              <code class="literal">CALL</code> statement executes a stored
              procedure that is executing a
              <a class="link" href="sql-syntax.html#select" title="13.2.9 SELECT Syntax"><code class="literal">SELECT</code></a> statement, the
              <code class="literal">PROCESSLIST_INFO</code> value shows the
              <a class="link" href="sql-syntax.html#select" title="13.2.9 SELECT Syntax"><code class="literal">SELECT</code></a> statement.
            </p></li><li class="listitem"><p>
              <code class="literal">PARENT_THREAD_ID</code>
            </p><p>
              If this thread is a subthread (spawned by another thread),
              this is the <code class="literal">THREAD_ID</code> value of the
              spawning thread.
            </p></li><li class="listitem"><p>
              <code class="literal">ROLE</code>
            </p><p>
              Unused.
            </p></li><li class="listitem"><p>
              <code class="literal">INSTRUMENTED</code>
            </p><p>
              Whether events executed by the thread are instrumented.
              The value is <code class="literal">YES</code> or
              <code class="literal">NO</code>.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  For foreground threads, the initial
                  <code class="literal">INSTRUMENTED</code> value is determined by
                  whether the user account associated with the thread
                  matches any row in the
                  <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table.
                  Matching is based on the values of the
                  <code class="literal">PROCESSLIST_USER</code> and
                  <code class="literal">PROCESSLIST_HOST</code> columns.
                </p><p>
                  If the thread spawns a subthread, matching occurs
                  again for the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a>
                  table row created for the subthread.
                </p></li><li class="listitem"><p>
                  For background threads,
                  <code class="literal">INSTRUMENTED</code> is
                  <code class="literal">YES</code> by default.
                  <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> is not
                  consulted because there is no associated user for
                  background threads.
                </p></li><li class="listitem"><p>
                  For any thread, its <code class="literal">INSTRUMENTED</code>
                  value can be changed during the lifetime of the
                  thread.
</p></li></ul>
</div>
<p>
              For monitoring of events executed by the thread to occur,
              these things must be true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  The <code class="literal">thread_instrumentation</code> consumer
                  in the <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a>
                  table must be <code class="literal">YES</code>.
                </p></li><li class="listitem"><p>
                  The <code class="literal">threads.INSTRUMENTED</code> column
                  must be <code class="literal">YES</code>.
                </p></li><li class="listitem"><p>
                  Monitoring occurs only for those thread events
                  produced from instruments that have the
                  <code class="literal">ENABLED</code> column set to
                  <code class="literal">YES</code> in the
                  <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
</p></li></ul>
</div>
</li><li class="listitem"><p>
              <code class="literal">HISTORY</code>
            </p><p>
              Whether to log historical events for the thread. The value
              is <code class="literal">YES</code> or <code class="literal">NO</code>.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  For foreground threads, the initial
                  <code class="literal">HISTORY</code> value is determined by
                  whether the user account associated with the thread
                  matches any row in the
                  <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table.
                  Matching is based on the values of the
                  <code class="literal">PROCESSLIST_USER</code> and
                  <code class="literal">PROCESSLIST_HOST</code> columns.
                </p><p>
                  If the thread spawns a subthread, matching occurs
                  again for the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a>
                  table row created for the subthread.
                </p></li><li class="listitem"><p>
                  For background threads, <code class="literal">HISTORY</code> is
                  <code class="literal">YES</code> by default.
                  <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> is not
                  consulted because there is no associated user for
                  background threads.
                </p></li><li class="listitem"><p>
                  For any thread, its <code class="literal">HISTORY</code> value
                  can be changed during the lifetime of the thread.
</p></li></ul>
</div>
<p>
              For historical event logging for the thread to occur,
              these things must be true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  The appropriate history-related consumers in the
                  <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table
                  must be enabled. For example, wait event logging in
                  the <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a>
                  and
                  <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>
                  tables requires the corresponding
                  <code class="literal">events_waits_history</code> and
                  <code class="literal">events_waits_history_long</code> consumers
                  to be <code class="literal">YES</code>.
                </p></li><li class="listitem"><p>
                  The <code class="literal">threads.HISTORY</code> column must be
                  <code class="literal">YES</code>.
                </p></li><li class="listitem"><p>
                  Logging occurs only for those thread events produced
                  from instruments that have the
                  <code class="literal">ENABLED</code> column set to
                  <code class="literal">YES</code> in the
                  <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table.
</p></li></ul>
</div>
</li><li class="listitem"><p>
              <code class="literal">CONNECTION_TYPE</code>
            </p><p>
              The protocol used to establish the connection, or
              <code class="literal">NULL</code> for background threads. Permitted
              values are <code class="literal">TCP/IP</code> (TCP/IP connection
              established without encryption),
              <code class="literal">SSL/TLS</code> (TCP/IP connection established
              with encryption), <code class="literal">Socket</code> (Unix socket
              file connection), <code class="literal">Named Pipe</code> (Windows
              named pipe connection), and <code class="literal">Shared
              Memory</code> (Windows shared memory connection).
            </p></li><li class="listitem"><p>
              <code class="literal">THREAD_OS_ID</code>
            </p><p>
              The thread or task identifier as defined by the underlying
              operating system, if there is one:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
                  When a MySQL thread is associated with the same
                  operating system thread for its lifetime,
                  <code class="literal">THREAD_OS_ID</code> contains the operating
                  system thread ID.
                </p></li><li class="listitem"><p>
                  When a MySQL thread is not associated with the same
                  operating system thread for its lifetime,
                  <code class="literal">THREAD_OS_ID</code> contains
                  <code class="literal">NULL</code>. This is typical for user
                  sessions when the thread pool plugin is used (see
                  <a class="xref" href="server-administration.html#thread-pool" title="5.5.3 MySQL Enterprise Thread Pool">Section 5.5.3, “MySQL Enterprise Thread Pool”</a>).
</p></li></ul>
</div>
<p>
              For Windows, <code class="literal">THREAD_OS_ID</code> corresponds
              to the thread ID visible in Process Explorer
              (<a class="ulink" href="https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" target="_top">https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx</a>).
            </p><p>
              For Linux, <code class="literal">THREAD_OS_ID</code> corresponds to
              the value of the <code class="literal">gettid()</code> function.
              This value is exposed, for example, using the
              <span class="command"><strong>perf</strong></span> or <span class="command"><strong>ps -L</strong></span>
              commands, or in the <code class="literal">proc</code> file system
              (<code class="filename">/proc/<em class="replaceable"><code>[pid]</code></em>/task/<em class="replaceable"><code>[tid]</code></em></code>).
              For more information, see the
              <code class="literal">perf-stat(1)</code>, <code class="literal">ps(1)</code>,
              and <code class="literal">proc(5)</code> man pages.
</p></li></ul>
</div>
<p>
          <a class="link" href="sql-syntax.html#truncate-table" title="13.1.34 TRUNCATE TABLE Syntax"><code class="literal">TRUNCATE TABLE</code></a> is not permitted
          for the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table.
</p>
</div>

</div>

</div>

<div class="section">

<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-option-variable-reference"></a>25.12 Performance Schema Option and Variable Reference</h2>

</div>

</div>

</div>

<div class="table">
<a name="idm139684626180992"></a><p class="title"><b>Table 25.3 Performance Schema Variable Reference</b></p>
<div class="table-contents">
<table frame="box" rules="all" summary="Reference for Performance Schema command-line options, system variables, and status variables."><col width="20%"><col width="15%"><col width="15%"><col width="15%"><col width="15%"><col width="15%"><col width="15%"><thead><tr><th scope="col">Name</th>
<th scope="col">Cmd-Line</th>
<th scope="col">Option File</th>
<th scope="col">System Var</th>
<th scope="col">Status Var</th>
<th scope="col">Var Scope</th>
<th scope="col">Dynamic</th>
</tr></thead><tbody><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema">performance_schema</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_accounts_lost">Performance_schema_accounts_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_accounts_size">performance_schema_accounts_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_cond_classes_lost">Performance_schema_cond_classes_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_cond_instances_lost">Performance_schema_cond_instances_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-stages-current">performance-schema-consumer-events-stages-current</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-stages-history">performance-schema-consumer-events-stages-history</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-stages-history-long">performance-schema-consumer-events-stages-history-long</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-statements-current">performance-schema-consumer-events-statements-current</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-statements-history">performance-schema-consumer-events-statements-history</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-statements-history-long">performance-schema-consumer-events-statements-history-long</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-transactions-current">performance-schema-consumer-events-transactions-current</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-transactions-history">performance-schema-consumer-events-transactions-history</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-transactions-history-long">performance-schema-consumer-events-transactions-history-long</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-waits-current">performance-schema-consumer-events-waits-current</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-waits-history">performance-schema-consumer-events-waits-history</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-waits-history-long">performance-schema-consumer-events-waits-history-long</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-global-instrumentation">performance-schema-consumer-global-instrumentation</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-statements-digest">performance-schema-consumer-statements-digest</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-thread-instrumentation">performance-schema-consumer-thread-instrumentation</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_digest_lost">Performance_schema_digest_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_digests_size">performance_schema_digests_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_stages_history_long_size">performance_schema_events_stages_history_long_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_stages_history_size">performance_schema_events_stages_history_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_statements_history_long_size">performance_schema_events_statements_history_long_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_statements_history_size">performance_schema_events_statements_history_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_transactions_history_long_size">performance_schema_events_transactions_history_long_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_transactions_history_size">performance_schema_events_transactions_history_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_long_size">performance_schema_events_waits_history_long_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_size">performance_schema_events_waits_history_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_file_classes_lost">Performance_schema_file_classes_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_file_handles_lost">Performance_schema_file_handles_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_file_instances_lost">Performance_schema_file_instances_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_hosts_lost">Performance_schema_hosts_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_hosts_size">performance_schema_hosts_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#option_mysqld_performance-schema-instrument">performance-schema-instrument</a></td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_locker_lost">Performance_schema_locker_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_cond_classes">performance_schema_max_cond_classes</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_cond_instances">performance_schema_max_cond_instances</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length">performance_schema_max_digest_length</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_classes">performance_schema_max_file_classes</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_handles">performance_schema_max_file_handles</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_instances">performance_schema_max_file_instances</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_memory_classes">performance_schema_max_memory_classes</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_metadata_locks">performance_schema_max_metadata_locks</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_classes">performance_schema_max_mutex_classes</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_instances">performance_schema_max_mutex_instances</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_prepared_statements_instances">performance_schema_max_prepared_statements_instances</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_program_instances">performance_schema_max_program_instances</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_rwlock_classes">performance_schema_max_rwlock_classes</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_rwlock_instances">performance_schema_max_rwlock_instances</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_socket_classes">performance_schema_max_socket_classes</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_socket_instances">performance_schema_max_socket_instances</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_stage_classes">performance_schema_max_stage_classes</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_statement_classes">performance_schema_max_statement_classes</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_statement_stack">performance_schema_max_statement_stack</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_handles">performance_schema_max_table_handles</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_instances">performance_schema_max_table_instances</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_thread_classes">performance_schema_max_thread_classes</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_thread_instances">performance_schema_max_thread_instances</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_memory_classes_lost">Performance_schema_memory_classes_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_metadata_lock_lost">Performance_schema_metadata_lock_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_classes_lost">Performance_schema_mutex_classes_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_instances_lost">Performance_schema_mutex_instances_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_nested_statement_lost">Performance_schema_nested_statement_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_prepared_statements_lost">Performance_schema_prepared_statements_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_program_lost">Performance_schema_program_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_rwlock_classes_lost">Performance_schema_rwlock_classes_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_rwlock_instances_lost">Performance_schema_rwlock_instances_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_session_connect_attrs_lost">Performance_schema_session_connect_attrs_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_session_connect_attrs_size">performance_schema_session_connect_attrs_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_setup_actors_size">performance_schema_setup_actors_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_setup_objects_size">performance_schema_setup_objects_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_socket_classes_lost">Performance_schema_socket_classes_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_socket_instances_lost">Performance_schema_socket_instances_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_stage_classes_lost">Performance_schema_stage_classes_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_statement_classes_lost">Performance_schema_statement_classes_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_table_handles_lost">Performance_schema_table_handles_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_table_instances_lost">Performance_schema_table_instances_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_thread_classes_lost">Performance_schema_thread_classes_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_thread_instances_lost">Performance_schema_thread_instances_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#statvar_Performance_schema_users_lost">Performance_schema_users_lost</a></td>
<td></td>
<td></td>
<td></td>
<td>Yes</td>
<td>Global</td>
<td>No</td>
</tr><tr><td scope="row"><a class="link" href="performance-schema.html#sysvar_performance_schema_users_size">performance_schema_users_size</a></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td>Global</td>
<td>No</td>
</tr></tbody></table>
</div>

</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-options"></a>25.13 Performance Schema Command Options</h2>

</div>

</div>

</div>
<p>
      Performance Schema parameters can be specified at server startup
      on the command line or in option files to configure Performance
      Schema instruments and consumers. Runtime configuration is also
      possible in many cases (see
      <a class="xref" href="performance-schema.html#performance-schema-runtime-configuration" title="25.4 Performance Schema Runtime Configuration">Section 25.4, “Performance Schema Runtime Configuration”</a>), but
      startup configuration must be used when runtime configuration is
      too late to affect instruments that have already been initialized
      during the startup process.
    </p><p>
      Performance Schema consumers and instruments can be configured at
      startup using the following syntax. For additional details, see
      <a class="xref" href="performance-schema.html#performance-schema-startup-configuration" title="25.3 Performance Schema Startup Configuration">Section 25.3, “Performance Schema Startup Configuration”</a>.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-xxx"></a>
          <a class="indexterm" name="idm139684625585504"></a>

          <a class="indexterm" name="idm139684625584000"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-xxx"><code class="option">--performance-schema-consumer-<em class="replaceable"><code>consumer_name</code></em>=<code class="literal">value</code></code></a>
        </p><p>
          Configure a Performance Schema consumer. Consumer names in the
          <a class="link" href="performance-schema.html#setup-consumers-table" title="25.11.2.2 The setup_consumers Table"><code class="literal">setup_consumers</code></a> table use
          underscores, but for consumers set at startup, dashes and
          underscores within the name are equivalent. Options for
          configuring individual consumers are detailed later in this
          section.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-instrument"></a>
          <a class="indexterm" name="idm139684625577248"></a>

          <a class="indexterm" name="idm139684625575744"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-instrument"><code class="option">--performance-schema-instrument=<em class="replaceable"><code>instrument_name</code></em>=<code class="literal">value</code></code></a>
        </p><p>
          Configure a Performance Schema instrument. The name may be
          given as a pattern to configure instruments that match the
          pattern.
</p></li></ul>
</div>
<p>
      The following items configure individual consumers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-stages-current"></a>
          <a class="indexterm" name="idm139684625569536"></a>

          <a class="indexterm" name="idm139684625568080"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-stages-current"><code class="option">--performance-schema-consumer-events-stages-current=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">events-stages-current</code>
          consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-stages-history"></a>
          <a class="indexterm" name="idm139684625562384"></a>

          <a class="indexterm" name="idm139684625560928"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-stages-history"><code class="option">--performance-schema-consumer-events-stages-history=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">events-stages-history</code>
          consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-stages-history-long"></a>
          <a class="indexterm" name="idm139684625555232"></a>

          <a class="indexterm" name="idm139684625553776"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-stages-history-long"><code class="option">--performance-schema-consumer-events-stages-history-long=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">events-stages-history-long</code>
          consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-statements-current"></a>
          <a class="indexterm" name="idm139684625548048"></a>

          <a class="indexterm" name="idm139684625546592"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-statements-current"><code class="option">--performance-schema-consumer-events-statements-current=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">events-statements-current</code>
          consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-statements-history"></a>
          <a class="indexterm" name="idm139684625540864"></a>

          <a class="indexterm" name="idm139684625539408"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-statements-history"><code class="option">--performance-schema-consumer-events-statements-history=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">events-statements-history</code>
          consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-statements-history-long"></a>
          <a class="indexterm" name="idm139684625533632"></a>

          <a class="indexterm" name="idm139684625532096"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-statements-history-long"><code class="option">--performance-schema-consumer-events-statements-history-long=<code class="literal">value</code></code></a>
        </p><p>
          Configure the
          <code class="literal">events-statements-history-long</code> consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-transactions-current"></a>
          <a class="indexterm" name="idm139684625526352"></a>

          <a class="indexterm" name="idm139684625524896"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-transactions-current"><code class="option">--performance-schema-consumer-events-transactions-current=<code class="literal">value</code></code></a>
        </p><p>
          Configure the Performance Schema
          <code class="literal">events-transactions-current</code> consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-transactions-history"></a>
          <a class="indexterm" name="idm139684625519168"></a>

          <a class="indexterm" name="idm139684625517712"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-transactions-history"><code class="option">--performance-schema-consumer-events-transactions-history=<code class="literal">value</code></code></a>
        </p><p>
          Configure the Performance Schema
          <code class="literal">events-transactions-history</code> consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-transactions-history-long"></a>
          <a class="indexterm" name="idm139684625512032"></a>

          <a class="indexterm" name="idm139684625510496"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-transactions-history-long"><code class="option">--performance-schema-consumer-events-transactions-history-long=<code class="literal">value</code></code></a>
        </p><p>
          Configure the Performance Schema
          <code class="literal">events-transactions-history-long</code> consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-waits-current"></a>
          <a class="indexterm" name="idm139684625504736"></a>

          <a class="indexterm" name="idm139684625503216"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-waits-current"><code class="option">--performance-schema-consumer-events-waits-current=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">events-waits-current</code>
          consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-waits-history"></a>
          <a class="indexterm" name="idm139684625497616"></a>

          <a class="indexterm" name="idm139684625496096"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-waits-history"><code class="option">--performance-schema-consumer-events-waits-history=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">events-waits-history</code>
          consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-events-waits-history-long"></a>
          <a class="indexterm" name="idm139684625490496"></a>

          <a class="indexterm" name="idm139684625489040"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-events-waits-history-long"><code class="option">--performance-schema-consumer-events-waits-history-long=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">events-waits-history-long</code>
          consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-global-instrumentation"></a>
          <a class="indexterm" name="idm139684625483312"></a>

          <a class="indexterm" name="idm139684625481856"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-global-instrumentation"><code class="option">--performance-schema-consumer-global-instrumentation=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">global-instrumentation</code>
          consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-statements-digest"></a>
          <a class="indexterm" name="idm139684625476160"></a>

          <a class="indexterm" name="idm139684625474640"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-statements-digest"><code class="option">--performance-schema-consumer-statements-digest=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">statements-digest</code> consumer.
        </p></li><li class="listitem"><p><a name="option_mysqld_performance-schema-consumer-thread-instrumentation"></a>
          <a class="indexterm" name="idm139684625469056"></a>

          <a class="indexterm" name="idm139684625467600"></a>

          <a class="link" href="performance-schema.html#option_mysqld_performance-schema-consumer-thread-instrumentation"><code class="option">--performance-schema-consumer-thread-instrumentation=<code class="literal">value</code></code></a>
        </p><p>
          Configure the <code class="literal">thread-instrumentation</code>
          consumer.
</p></li></ul>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-system-variables"></a>25.14 Performance Schema System Variables</h2>

</div>

</div>

</div>
<p>
      The Performance Schema implements several system variables that
      provide configuration information:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SHOW VARIABLES LIKE 'perf%';</code></strong>
+----------------------------------------------------------+-------+
| Variable_name                                            | Value |
+----------------------------------------------------------+-------+
| performance_schema                                       | ON    |
| performance_schema_accounts_size                         | -1    |
| performance_schema_digests_size                          | 10000 |
| performance_schema_events_stages_history_long_size       | 10000 |
| performance_schema_events_stages_history_size            | 10    |
| performance_schema_events_statements_history_long_size   | 10000 |
| performance_schema_events_statements_history_size        | 10    |
| performance_schema_events_transactions_history_long_size | 10000 |
| performance_schema_events_transactions_history_size      | 10    |
| performance_schema_events_waits_history_long_size        | 10000 |
| performance_schema_events_waits_history_size             | 10    |
| performance_schema_hosts_size                            | -1    |
| performance_schema_max_cond_classes                      | 80    |
| performance_schema_max_cond_instances                    | -1    |
| performance_schema_max_digest_length                     | 1024  |
| performance_schema_max_file_classes                      | 50    |
| performance_schema_max_file_handles                      | 32768 |
| performance_schema_max_file_instances                    | -1    |
| performance_schema_max_index_stat                        | -1    |
| performance_schema_max_memory_classes                    | 320   |
| performance_schema_max_metadata_locks                    | -1    |
| performance_schema_max_mutex_classes                     | 200   |
| performance_schema_max_mutex_instances                   | -1    |
| performance_schema_max_prepared_statements_instances     | -1    |
| performance_schema_max_program_instances                 | -1    |
| performance_schema_max_rwlock_classes                    | 40    |
| performance_schema_max_rwlock_instances                  | -1    |
| performance_schema_max_socket_classes                    | 10    |
| performance_schema_max_socket_instances                  | -1    |
| performance_schema_max_sql_text_length                   | 1024  |
| performance_schema_max_stage_classes                     | 150   |
| performance_schema_max_statement_classes                 | 192   |
| performance_schema_max_statement_stack                   | 10    |
| performance_schema_max_table_handles                     | -1    |
| performance_schema_max_table_instances                   | -1    |
| performance_schema_max_table_lock_stat                   | -1    |
| performance_schema_max_thread_classes                    | 50    |
| performance_schema_max_thread_instances                  | -1    |
| performance_schema_session_connect_attrs_size            | 512   |
| performance_schema_setup_actors_size                     | -1    |
| performance_schema_setup_objects_size                    | -1    |
| performance_schema_users_size                            | -1    |
+----------------------------------------------------------+-------+
</pre><p>
      Performance Schema system variables can be set at server startup
      on the command line or in option files, and many can be set at
      runtime. See
      <a class="xref" href="performance-schema.html#performance-schema-option-variable-reference" title="25.12 Performance Schema Option and Variable Reference">Section 25.12, “Performance Schema Option and Variable Reference”</a>.
    </p><p>
      The Performance Schema automatically sizes the values of several
      of its parameters at server startup if they are not set
      explicitly. For more information, see
      <a class="xref" href="performance-schema.html#performance-schema-startup-configuration" title="25.3 Performance Schema Startup Configuration">Section 25.3, “Performance Schema Startup Configuration”</a>.
    </p><p>
      Performance Schema system variables have the following meanings:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a name="sysvar_performance_schema"></a>
          <a class="indexterm" name="idm139684625448672"></a>

          <a class="indexterm" name="idm139684625447632"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema"><code class="literal">performance_schema</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema">performance_schema</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>boolean</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">ON</code></td>
</tr></tbody></table>
</div>
<p>
          The value of this variable is <code class="literal">ON</code> or
          <code class="literal">OFF</code> to indicate whether the Performance
          Schema is enabled. By default, the value is
          <code class="literal">ON</code>. At server startup, you can specify this
          variable with no value or a value of <code class="literal">ON</code> or
          1 to enable it, or with a value of <code class="literal">OFF</code> or 0
          to disable it.
        </p><p>
          Even when the Performance Schema is disabled, it continues to
          populate the <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">global_variables</code></a>,
          <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">session_variables</code></a>,
          <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">global_status</code></a>, and
          <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">session_status</code></a> tables. This
          occurs as necessary to permit the results for the
          <a class="link" href="sql-syntax.html#show-variables" title="13.7.5.39 SHOW VARIABLES Syntax"><code class="literal">SHOW VARIABLES</code></a> and
          <a class="link" href="sql-syntax.html#show-status" title="13.7.5.35 SHOW STATUS Syntax"><code class="literal">SHOW STATUS</code></a> statements to be
          drawn from those tables, depending on the setting of the
          <code class="literal">show_compatibiliy_56</code> system variable.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_accounts_size"></a>
          <a class="indexterm" name="idm139684625406784"></a>

          <a class="indexterm" name="idm139684625405680"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_accounts_size"><code class="literal">performance_schema_accounts_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_accounts_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-accounts-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_accounts_size">performance_schema_accounts_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">1048576</code></td>
</tr></tbody></table>
</div>
<p>
          The number of rows in the
          <a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a> table. If this variable
          is 0, the Performance Schema does not maintain connection
          statistics in the <a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a> table
          or status variable information in the
          <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_account</code></a> table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_digests_size"></a>
          <a class="indexterm" name="idm139684625359840"></a>

          <a class="indexterm" name="idm139684625358736"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_digests_size"><code class="literal">performance_schema_digests_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_digests_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-digests-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_digests_size">performance_schema_digests_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">-1</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">1048576</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of rows in the
          <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>
          table. If this maximum is exceeded such that a digest cannot
          be instrumented, the Performance Schema increments the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_digest_lost"><code class="literal">Performance_schema_digest_lost</code></a>
          status variable.
        </p><p>
          For more information about statement digesting, see
          <a class="xref" href="performance-schema.html#performance-schema-statement-digests" title="25.9 Performance Schema Statement Digests">Section 25.9, “Performance Schema Statement Digests”</a>.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_events_stages_history_long_size"></a>
          <a class="indexterm" name="idm139684625320208"></a>

          <a class="indexterm" name="idm139684625319168"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_stages_history_long_size"><code class="literal">performance_schema_events_stages_history_long_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_stages_history_long_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-events-stages-history-long-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_stages_history_long_size">performance_schema_events_stages_history_long_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The number of rows in the
          <a class="link" href="performance-schema.html#events-stages-history-long-table" title="25.11.5.3 The events_stages_history_long Table"><code class="literal">events_stages_history_long</code></a> table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_events_stages_history_size"></a>
          <a class="indexterm" name="idm139684625289216"></a>

          <a class="indexterm" name="idm139684625288096"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_stages_history_size"><code class="literal">performance_schema_events_stages_history_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_stages_history_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-events-stages-history-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_stages_history_size">performance_schema_events_stages_history_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The number of rows per thread in the
          <a class="link" href="performance-schema.html#events-stages-history-table" title="25.11.5.2 The events_stages_history Table"><code class="literal">events_stages_history</code></a> table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_events_statements_history_long_size"></a>
          <a class="indexterm" name="idm139684625258128"></a>

          <a class="indexterm" name="idm139684625257088"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_statements_history_long_size"><code class="literal">performance_schema_events_statements_history_long_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_statements_history_long_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-events-statements-history-long-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_statements_history_long_size">performance_schema_events_statements_history_long_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The number of rows in the
          <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>
          table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_events_statements_history_size"></a>
          <a class="indexterm" name="idm139684625227040"></a>

          <a class="indexterm" name="idm139684625226000"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_statements_history_size"><code class="literal">performance_schema_events_statements_history_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_statements_history_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-events-statements-history-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_statements_history_size">performance_schema_events_statements_history_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The number of rows per thread in the
          <a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a> table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_events_transactions_history_long_size"></a>
          <a class="indexterm" name="idm139684625195936"></a>

          <a class="indexterm" name="idm139684625194800"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_transactions_history_long_size"><code class="literal">performance_schema_events_transactions_history_long_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_transactions_history_long_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-events-transactions-history-long-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.3</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_transactions_history_long_size">performance_schema_events_transactions_history_long_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The number of rows in the
          <a class="link" href="performance-schema.html#events-transactions-history-long-table" title="25.11.7.3 The events_transactions_history_long Table"><code class="literal">events_transactions_history_long</code></a>
          table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_events_transactions_history_size"></a>
          <a class="indexterm" name="idm139684625162064"></a>

          <a class="indexterm" name="idm139684625161024"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_transactions_history_size"><code class="literal">performance_schema_events_transactions_history_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_transactions_history_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-events-transactions-history-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.3</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_transactions_history_size">performance_schema_events_transactions_history_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The number of rows per thread in the
          <a class="link" href="performance-schema.html#events-transactions-history-table" title="25.11.7.2 The events_transactions_history Table"><code class="literal">events_transactions_history</code></a>
          table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_events_waits_history_long_size"></a>
          <a class="indexterm" name="idm139684625128256"></a>

          <a class="indexterm" name="idm139684625127216"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_long_size"><code class="literal">performance_schema_events_waits_history_long_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_waits_history_long_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-events-waits-history-long-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_long_size">performance_schema_events_waits_history_long_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The number of rows in the
          <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a> table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_events_waits_history_size"></a>
          <a class="indexterm" name="idm139684625097200"></a>

          <a class="indexterm" name="idm139684625096080"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_size"><code class="literal">performance_schema_events_waits_history_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_waits_history_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-events-waits-history-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_events_waits_history_size">performance_schema_events_waits_history_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The number of rows per thread in the
          <a class="link" href="performance-schema.html#events-waits-history-table" title="25.11.4.2 The events_waits_history Table"><code class="literal">events_waits_history</code></a> table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_hosts_size"></a>
          <a class="indexterm" name="idm139684625066256"></a>

          <a class="indexterm" name="idm139684625065152"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_hosts_size"><code class="literal">performance_schema_hosts_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_hosts_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-hosts-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_hosts_size">performance_schema_hosts_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">1048576</code></td>
</tr></tbody></table>
</div>
<p>
          The number of rows in the <a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a>
          table. If this variable is 0, the Performance Schema does not
          maintain connection statistics in the
          <a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a> table or status variable
          information in the <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_host</code></a>
          table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_cond_classes"></a>
          <a class="indexterm" name="idm139684625019200"></a>

          <a class="indexterm" name="idm139684625018160"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_cond_classes"><code class="literal">performance_schema_max_cond_classes</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_cond_classes"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-cond-classes=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_cond_classes">performance_schema_max_cond_classes</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">80</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">0</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">256</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of condition instruments.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_cond_instances"></a>
          <a class="indexterm" name="idm139684624983664"></a>

          <a class="indexterm" name="idm139684624982624"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_cond_instances"><code class="literal">performance_schema_max_cond_instances</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_cond_instances"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-cond-instances=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_cond_instances">performance_schema_max_cond_instances</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of instrumented condition objects.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_digest_length"></a>
          <a class="indexterm" name="idm139684624950448"></a>

          <a class="indexterm" name="idm139684624949408"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length"><code class="literal">performance_schema_max_digest_length</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_digest_length"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-digest-length=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.8</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_digest_length">performance_schema_max_digest_length</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">1024</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">0</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">1048576</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of bytes available for storage of
          normalized statement digest values in the Performance Schema.
          This variable is related to
          <a class="link" href="server-administration.html#sysvar_max_digest_length"><code class="literal">max_digest_length</code></a>; see the
          description of that variable in
          <a class="xref" href="server-administration.html#server-system-variables" title="5.1.7 Server System Variables">Section 5.1.7, “Server System Variables”</a>
        </p><p>
          For more information about statement digesting, see
          <a class="xref" href="performance-schema.html#performance-schema-statement-digests" title="25.9 Performance Schema Statement Digests">Section 25.9, “Performance Schema Statement Digests”</a>.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_file_classes"></a>
          <a class="indexterm" name="idm139684624908832"></a>

          <a class="indexterm" name="idm139684624907792"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_classes"><code class="literal">performance_schema_max_file_classes</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_file_classes"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-file-classes=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_classes">performance_schema_max_file_classes</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.9)</td>
<td><code class="literal">80</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.8)</td>
<td><code class="literal">50</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">0</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">256</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of file instruments.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_file_handles"></a>
          <a class="indexterm" name="idm139684624869936"></a>

          <a class="indexterm" name="idm139684624868896"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_handles"><code class="literal">performance_schema_max_file_handles</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_file_handles"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-file-handles=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_handles">performance_schema_max_file_handles</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">32768</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of opened file objects.
        </p><p>
          The value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_handles"><code class="literal">performance_schema_max_file_handles</code></a>
          should be greater than the value of
          <a class="link" href="server-administration.html#sysvar_open_files_limit"><code class="literal">open_files_limit</code></a>:
          <a class="link" href="server-administration.html#sysvar_open_files_limit"><code class="literal">open_files_limit</code></a> affects the
          maximum number of open file handles the server can support and
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_handles"><code class="literal">performance_schema_max_file_handles</code></a>
          affects how many of these file handles can be instrumented.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_file_instances"></a>
          <a class="indexterm" name="idm139684624834768"></a>

          <a class="indexterm" name="idm139684624833696"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_instances"><code class="literal">performance_schema_max_file_instances</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_file_instances"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-file-instances=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_file_instances">performance_schema_max_file_instances</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of instrumented file objects.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_index_stat"></a>
          <a class="indexterm" name="idm139684624801568"></a>

          <a class="indexterm" name="idm139684624800528"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_index_stat"><code class="literal">performance_schema_max_index_stat</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_index_stat"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-index-stat=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.6</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_index_stat">performance_schema_max_index_stat</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of indexes for which the Performance Schema
          maintains statistics. If this maximum is exceeded such that
          index statistics are lost, the Performance Schema increments
          the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_index_stat_lost"><code class="literal">Performance_schema_index_stat_lost</code></a>
          status variable. The default value is autosized using the
          value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_instances"><code class="literal">performance_schema_max_table_instances</code></a>.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_memory_classes"></a>
          <a class="indexterm" name="idm139684624766368"></a>

          <a class="indexterm" name="idm139684624765328"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_memory_classes"><code class="literal">performance_schema_max_memory_classes</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_memory_classes"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-memory-classes=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.2</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_memory_classes">performance_schema_max_memory_classes</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.5)</td>
<td><code class="literal">320</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.4)</td>
<td><code class="literal">250</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of memory instruments.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_metadata_locks"></a>
          <a class="indexterm" name="idm139684624730784"></a>

          <a class="indexterm" name="idm139684624729744"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_metadata_locks"><code class="literal">performance_schema_max_metadata_locks</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_metadata_locks"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-metadata-locks=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.3</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_metadata_locks">performance_schema_max_metadata_locks</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of metadata lock instruments. This value
          controls the size of the
          <a class="link" href="performance-schema.html#metadata-locks-table" title="25.11.12.1 The metadata_locks Table"><code class="literal">metadata_locks</code></a> table. If this
          maximum is exceeded such that a metadata lock cannot be
          instrumented, the Performance Schema increments the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_metadata_lock_lost"><code class="literal">Performance_schema_metadata_lock_lost</code></a>
          status variable.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_mutex_classes"></a>
          <a class="indexterm" name="idm139684624692080"></a>

          <a class="indexterm" name="idm139684624691040"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_classes"><code class="literal">performance_schema_max_mutex_classes</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_mutex_classes"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-mutex-classes=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_classes">performance_schema_max_mutex_classes</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">200</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">0</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">256</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of mutex instruments.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_mutex_instances"></a>
          <a class="indexterm" name="idm139684624656528"></a>

          <a class="indexterm" name="idm139684624655488"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_instances"><code class="literal">performance_schema_max_mutex_instances</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_mutex_instances"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-mutex-instances=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_mutex_instances">performance_schema_max_mutex_instances</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of instrumented mutex objects.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_prepared_statements_instances"></a>
          <a class="indexterm" name="idm139684624623216"></a>

          <a class="indexterm" name="idm139684624622176"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_prepared_statements_instances"><code class="literal">performance_schema_max_prepared_statements_instances</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_prepared_statements_instances"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-prepared-statements-instances=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.4</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_prepared_statements_instances">performance_schema_max_prepared_statements_instances</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of rows in the
          <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
          table. If this maximum is exceeded such that a prepared
          statement cannot be instrumented, the Performance Schema
          increments the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_prepared_statements_lost"><code class="literal">Performance_schema_prepared_statements_lost</code></a>
          status variable. The default value of this variable is
          autosized based on the value of the
          <a class="link" href="server-administration.html#sysvar_max_prepared_stmt_count"><code class="literal">max_prepared_stmt_count</code></a>
          system variable.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_rwlock_classes"></a>
          <a class="indexterm" name="idm139684624582976"></a>

          <a class="indexterm" name="idm139684624581936"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_rwlock_classes"><code class="literal">performance_schema_max_rwlock_classes</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_rwlock_classes"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-rwlock-classes=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_rwlock_classes">performance_schema_max_rwlock_classes</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.3)</td>
<td><code class="literal">40</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.2)</td>
<td><code class="literal">30</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">0</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">256</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of rwlock instruments.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_program_instances"></a>
          <a class="indexterm" name="idm139684624544016"></a>

          <a class="indexterm" name="idm139684624542896"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_program_instances"><code class="literal">performance_schema_max_program_instances</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_program_instances"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-program-instances=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.2</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_program_instances">performance_schema_max_program_instances</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">5000</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of stored programs for which the
          Performance Schema maintains statistics. If this maximum is
          exceeded, the Performance Schema increments the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_program_lost"><code class="literal">Performance_schema_program_lost</code></a>
          status variable.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_rwlock_instances"></a>
          <a class="indexterm" name="idm139684624506736"></a>

          <a class="indexterm" name="idm139684624505696"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_rwlock_instances"><code class="literal">performance_schema_max_rwlock_instances</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_rwlock_instances"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-rwlock-instances=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_rwlock_instances">performance_schema_max_rwlock_instances</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of instrumented rwlock objects.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_socket_classes"></a>
          <a class="indexterm" name="idm139684624473472"></a>

          <a class="indexterm" name="idm139684624472432"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_socket_classes"><code class="literal">performance_schema_max_socket_classes</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_socket_classes"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-socket-classes=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_socket_classes">performance_schema_max_socket_classes</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">10</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">0</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">256</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of socket instruments.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_socket_instances"></a>
          <a class="indexterm" name="idm139684624437920"></a>

          <a class="indexterm" name="idm139684624436880"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_socket_instances"><code class="literal">performance_schema_max_socket_instances</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_socket_instances"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-socket-instances=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_socket_instances">performance_schema_max_socket_instances</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of instrumented socket objects.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_sql_text_length"></a>
          <a class="indexterm" name="idm139684624404656"></a>

          <a class="indexterm" name="idm139684624403616"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_sql_text_length"><code class="literal">performance_schema_max_sql_text_length</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_sql_text_length"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-sql-text-length=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.6</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_sql_text_length">performance_schema_max_sql_text_length</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">1024</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">0</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">1048576</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of bytes used to store SQL statements in
          the <code class="literal">SQL_TEXT</code> column of the
          <a class="link" href="performance-schema.html#events-statements-current-table" title="25.11.6.1 The events_statements_current Table"><code class="literal">events_statements_current</code></a>,
          <a class="link" href="performance-schema.html#events-statements-history-table" title="25.11.6.2 The events_statements_history Table"><code class="literal">events_statements_history</code></a>, and
          <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>
          statement event tables. Any bytes in excess of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_sql_text_length"><code class="literal">performance_schema_max_sql_text_length</code></a>
          are discarded and do not appear in the
          <code class="literal">SQL_TEXT</code> column. Statements differing only
          after that many initial bytes are indistinguishable in this
          column.
        </p><p>
          Decreasing the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_sql_text_length"><code class="literal">performance_schema_max_sql_text_length</code></a>
          value reduces memory use but causes more statements to become
          indistinguishable if they differ only at the end. Increasing
          the value increases memory use but permits longer statements
          to be distinguished.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_stage_classes"></a>
          <a class="indexterm" name="idm139684624357536"></a>

          <a class="indexterm" name="idm139684624356496"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_stage_classes"><code class="literal">performance_schema_max_stage_classes</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_stage_classes"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-stage-classes=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_stage_classes">performance_schema_max_stage_classes</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">150</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">0</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">256</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of stage instruments.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_statement_classes"></a>
          <a class="indexterm" name="idm139684624321936"></a>

          <a class="indexterm" name="idm139684624320816"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_statement_classes"><code class="literal">performance_schema_max_statement_classes</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_statement_classes"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-statement-classes=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_statement_classes">performance_schema_max_statement_classes</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of statement instruments. The default value
          is calculated at server build time based on the number of
          commands in the client/server protocol and the number of SQL
          statement types supported by the server.
        </p><p>
          This variable should not be changed, unless to set it to 0 to
          disable all statement instrumentation and save all memory
          associated with it. Setting the variable to nonzero values
          other than the default has no benefit; in particular, values
          larger than the default cause more memory to be allocated then
          is needed.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_statement_stack"></a>
          <a class="indexterm" name="idm139684624291232"></a>

          <a class="indexterm" name="idm139684624290192"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_statement_stack"><code class="literal">performance_schema_max_statement_stack</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_statement_stack"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-statement-stack=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.2</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_statement_stack">performance_schema_max_statement_stack</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">10</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum depth of nested stored program calls for which the
          Performance Schema maintains statistics. When this maximum is
          exceeded, the Performance Schema increments the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_nested_statement_lost"><code class="literal">Performance_schema_nested_statement_lost</code></a>
          status variable for each stored program statement executed.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_table_handles"></a>
          <a class="indexterm" name="idm139684624257568"></a>

          <a class="indexterm" name="idm139684624256528"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_handles"><code class="literal">performance_schema_max_table_handles</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_table_handles"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-table-handles=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_handles">performance_schema_max_table_handles</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of opened table objects. This value
          controls the size of the
          <a class="link" href="performance-schema.html#table-handles-table" title="25.11.12.2 The table_handles Table"><code class="literal">table_handles</code></a> table. If this
          maximum is exceeded such that a table handle cannot be
          instrumented, the Performance Schema increments the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_table_handles_lost"><code class="literal">Performance_schema_table_handles_lost</code></a>
          status variable.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_table_instances"></a>
          <a class="indexterm" name="idm139684624221552"></a>

          <a class="indexterm" name="idm139684624220512"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_instances"><code class="literal">performance_schema_max_table_instances</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_table_instances"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-table-instances=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_instances">performance_schema_max_table_instances</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of instrumented table objects.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_table_lock_stat"></a>
          <a class="indexterm" name="idm139684624188288"></a>

          <a class="indexterm" name="idm139684624187248"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_lock_stat"><code class="literal">performance_schema_max_table_lock_stat</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_table_lock_stat"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-table-lock-stat=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Introduced</strong></span></td>
<td>5.7.6</td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_lock_stat">performance_schema_max_table_lock_stat</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of tables for which the Performance Schema
          maintains lock statistics. If this maximum is exceeded such
          that table lock statistics are lost, the Performance Schema
          increments the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_table_lock_stat_lost"><code class="literal">Performance_schema_table_lock_stat_lost</code></a>
          status variable.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_thread_classes"></a>
          <a class="indexterm" name="idm139684624154432"></a>

          <a class="indexterm" name="idm139684624153392"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_thread_classes"><code class="literal">performance_schema_max_thread_classes</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_thread_classes"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-thread-classes=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_thread_classes">performance_schema_max_thread_classes</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">50</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">0</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">256</code></td>
</tr></tbody></table>
</div>
<p>
          The maximum number of thread instruments.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_max_thread_instances"></a>
          <a class="indexterm" name="idm139684624118880"></a>

          <a class="indexterm" name="idm139684624117840"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_thread_instances"><code class="literal">performance_schema_max_thread_instances</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_thread_instances"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-max-thread-instances=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_max_thread_instances">performance_schema_max_thread_instances</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr></tbody></table>
</div>
<p>
          The maximum number of instrumented thread objects. The value
          controls the size of the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a>
          table. If this maximum is exceeded such that a thread cannot
          be instrumented, the Performance Schema increments the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_thread_instances_lost"><code class="literal">Performance_schema_thread_instances_lost</code></a>
          status variable.
        </p><p>
          The <a class="link" href="server-administration.html#sysvar_max_connections"><code class="literal">max_connections</code></a> system
          variable affects how many threads can run in the server.
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_thread_instances"><code class="literal">performance_schema_max_thread_instances</code></a>
          affects how many of these running threads can be instrumented.
        </p><p>
          The <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">variables_by_thread</code></a> and
          <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">status_by_thread</code></a> tables contain
          system and status variable information information only about
          foreground threads. If not all threads are instrumented by the
          Performance Schema, this table will miss some rows. In this
          case, the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_thread_instances_lost"><code class="literal">Performance_schema_thread_instances_lost</code></a>
          status variable will be greater than zero.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_session_connect_attrs_size"></a>
          <a class="indexterm" name="idm139684624075152"></a>

          <a class="indexterm" name="idm139684624074032"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_session_connect_attrs_size"><code class="literal">performance_schema_session_connect_attrs_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_session_connect_attrs_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-session-connect-attrs-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_session_connect_attrs_size">performance_schema_session_connect_attrs_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span></td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span></td>
<td><code class="literal">-1</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">1048576</code></td>
</tr></tbody></table>
</div>
<p>
          The amount of preallocated memory per thread reserved to hold
          connection attribute key/value pairs. If the aggregate size of
          connection attribute data sent by a client is larger than this
          amount, the Performance Schema truncates the attribute data,
          increments the
          <a class="link" href="performance-schema.html#statvar_Performance_schema_session_connect_attrs_lost"><code class="literal">Performance_schema_session_connect_attrs_lost</code></a>
          status variable, and writes a message to the error log
          indicating that truncation occurred if the
          <a class="link" href="server-administration.html#sysvar_log_error_verbosity"><code class="literal">log_error_verbosity</code></a> system
          variable value is greater than 1.
        </p><p>
          The default value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_session_connect_attrs_size"><code class="literal">performance_schema_session_connect_attrs_size</code></a>
          is autosized at server startup. This value may be small, so if
          truncation occurs
          (<a class="link" href="performance-schema.html#statvar_Performance_schema_session_connect_attrs_lost"><code class="literal">Performance_schema_session_connect_attrs_lost</code></a>
          becomes nonzero), you may wish to set
          <a class="link" href="performance-schema.html#sysvar_performance_schema_session_connect_attrs_size"><code class="literal">performance_schema_session_connect_attrs_size</code></a>
          explicitly to a larger value.
        </p><p>
          Although the maximum permitted
          <a class="link" href="performance-schema.html#sysvar_performance_schema_session_connect_attrs_size"><code class="literal">performance_schema_session_connect_attrs_size</code></a>
          value is 1MB, the effective maximum is 64KB because the server
          imposes a limit of 64KB on the aggregate size of connection
          attribute data it will accept. If a client attempts to send
          more than 64KB of attribute data, the server rejects the
          connection. For more information, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-attribute-tables" title="25.11.9 Performance Schema Connection Attribute Tables">Section 25.11.9, “Performance Schema Connection Attribute Tables”</a>.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_setup_actors_size"></a>
          <a class="indexterm" name="idm139684624028896"></a>

          <a class="indexterm" name="idm139684624027856"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_setup_actors_size"><code class="literal">performance_schema_setup_actors_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_setup_actors_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-setup-actors-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_setup_actors_size">performance_schema_setup_actors_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">100</code></td>
</tr></tbody></table>
</div>
<p>
          The number of rows in the
          <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_setup_objects_size"></a>
          <a class="indexterm" name="idm139684623994624"></a>

          <a class="indexterm" name="idm139684623993584"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_setup_objects_size"><code class="literal">performance_schema_setup_objects_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_setup_objects_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-setup-objects-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_setup_objects_size">performance_schema_setup_objects_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">100</code></td>
</tr></tbody></table>
</div>
<p>
          The number of rows in the
          <a class="link" href="performance-schema.html#setup-objects-table" title="25.11.2.4 The setup_objects Table"><code class="literal">setup_objects</code></a> table.
        </p></li><li class="listitem"><p><a name="sysvar_performance_schema_users_size"></a>
          <a class="indexterm" name="idm139684623960400"></a>

          <a class="indexterm" name="idm139684623959296"></a>

          <a class="link" href="performance-schema.html#sysvar_performance_schema_users_size"><code class="literal">performance_schema_users_size</code></a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_users_size"><col width="50%"><col width="50%"><thead><tr><th scope="col">Property</th>
<th scope="col">Value</th>
</tr></thead><tbody><tr><td scope="row"><span class="bold"><strong>Command-Line Format</strong></span></td>
<td><code class="literal">--performance-schema-users-size=#</code></td>
</tr><tr><td scope="row"><span class="bold"><strong>System Variable</strong></span></td>
<td><code class="literal"><a class="link" href="performance-schema.html#sysvar_performance_schema_users_size">performance_schema_users_size</a></code></td>
</tr><tr><td scope="row"><span class="bold"><strong>Scope</strong></span></td>
<td>Global</td>
</tr><tr><td scope="row"><span class="bold"><strong>Dynamic</strong></span></td>
<td>No</td>
</tr><tr><td scope="row"><span class="bold"><strong>Type</strong></span></td>
<td>integer</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Default Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span> (&gt;= 5.7.6)</td>
<td><code class="literal">-1</code> (signifies autoscaling; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Minimum Value</strong></span> (&lt;= 5.7.5)</td>
<td><code class="literal">-1</code> (signifies autosizing; do not assign this literal value)</td>
</tr><tr><td scope="row"><span class="bold"><strong>Maximum Value</strong></span></td>
<td><code class="literal">1048576</code></td>
</tr></tbody></table>
</div>
<p>
          The number of rows in the <a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a>
          table. If this variable is 0, the Performance Schema does not
          maintain connection statistics in the
          <a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a> table or status variable
          information in the <a class="link" href="performance-schema.html#performance-schema-status-variable-summary-tables" title="25.11.15.10 Status Variable Summary Tables"><code class="literal">status_by_user</code></a>
          table.
</p></li></ul>
</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-status-variables"></a>25.15 Performance Schema Status Variables</h2>

</div>

</div>

</div>
<p>
      The Performance Schema implements several status variables that
      provide information about instrumentation that could not be loaded
      or created due to memory constraints:
    </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SHOW STATUS LIKE 'perf%';</code></strong>
+-------------------------------------------+-------+
| Variable_name                             | Value |
+-------------------------------------------+-------+
| Performance_schema_accounts_lost          | 0     |
| Performance_schema_cond_classes_lost      | 0     |
| Performance_schema_cond_instances_lost    | 0     |
| Performance_schema_file_classes_lost      | 0     |
| Performance_schema_file_handles_lost      | 0     |
| Performance_schema_file_instances_lost    | 0     |
| Performance_schema_hosts_lost             | 0     |
| Performance_schema_locker_lost            | 0     |
| Performance_schema_mutex_classes_lost     | 0     |
| Performance_schema_mutex_instances_lost   | 0     |
| Performance_schema_rwlock_classes_lost    | 0     |
| Performance_schema_rwlock_instances_lost  | 0     |
| Performance_schema_socket_classes_lost    | 0     |
| Performance_schema_socket_instances_lost  | 0     |
| Performance_schema_stage_classes_lost     | 0     |
| Performance_schema_statement_classes_lost | 0     |
| Performance_schema_table_handles_lost     | 0     |
| Performance_schema_table_instances_lost   | 0     |
| Performance_schema_thread_classes_lost    | 0     |
| Performance_schema_thread_instances_lost  | 0     |
| Performance_schema_users_lost             | 0     |
+-------------------------------------------+-------+
</pre><p>
      Performance Schema status variables have the following meanings:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a name="statvar_Performance_schema_accounts_lost"></a>
          <a class="indexterm" name="idm139684623906256"></a>

          <a class="indexterm" name="idm139684623905216"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_accounts_lost"><code class="literal">Performance_schema_accounts_lost</code></a>
        </p><p>
          The number of times a row could not be added to the
          <a class="link" href="performance-schema.html#accounts-table" title="25.11.8.1 The accounts Table"><code class="literal">accounts</code></a> table because it was
          full.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_cond_classes_lost"></a>
          <a class="indexterm" name="idm139684623899360"></a>

          <a class="indexterm" name="idm139684623898320"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_cond_classes_lost"><code class="literal">Performance_schema_cond_classes_lost</code></a>
        </p><p>
          How many condition instruments could not be loaded.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_cond_instances_lost"></a>
          <a class="indexterm" name="idm139684623893744"></a>

          <a class="indexterm" name="idm139684623892704"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_cond_instances_lost"><code class="literal">Performance_schema_cond_instances_lost</code></a>
        </p><p>
          How many condition instrument instances could not be created.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_digest_lost"></a>
          <a class="indexterm" name="idm139684623888160"></a>

          <a class="indexterm" name="idm139684623887056"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_digest_lost"><code class="literal">Performance_schema_digest_lost</code></a>
        </p><p>
          The number of digest instances that could not be instrumented
          in the
          <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_digest</code></a>
          table. This can be nonzero if the value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_digests_size"><code class="literal">performance_schema_digests_size</code></a>
          is too small.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_file_classes_lost"></a>
          <a class="indexterm" name="idm139684623879904"></a>

          <a class="indexterm" name="idm139684623878864"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_file_classes_lost"><code class="literal">Performance_schema_file_classes_lost</code></a>
        </p><p>
          How many file instruments could not be loaded.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_file_handles_lost"></a>
          <a class="indexterm" name="idm139684623874288"></a>

          <a class="indexterm" name="idm139684623873248"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_file_handles_lost"><code class="literal">Performance_schema_file_handles_lost</code></a>
        </p><p>
          How many file instrument instances could not be opened.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_file_instances_lost"></a>
          <a class="indexterm" name="idm139684623868656"></a>

          <a class="indexterm" name="idm139684623867616"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_file_instances_lost"><code class="literal">Performance_schema_file_instances_lost</code></a>
        </p><p>
          How many file instrument instances could not be created.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_hosts_lost"></a>
          <a class="indexterm" name="idm139684623863072"></a>

          <a class="indexterm" name="idm139684623861968"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_hosts_lost"><code class="literal">Performance_schema_hosts_lost</code></a>
        </p><p>
          The number of times a row could not be added to the
          <a class="link" href="performance-schema.html#hosts-table" title="25.11.8.2 The hosts Table"><code class="literal">hosts</code></a> table because it was full.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_index_stat_lost"></a>
          <a class="indexterm" name="idm139684623856208"></a>

          <a class="indexterm" name="idm139684623855168"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_index_stat_lost"><code class="literal">Performance_schema_index_stat_lost</code></a>
        </p><p>
          The number of indexes for which statistics were lost. This can
          be nonzero if the value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_index_stat"><code class="literal">performance_schema_max_index_stat</code></a>
          is too small.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_locker_lost"></a>
          <a class="indexterm" name="idm139684623849248"></a>

          <a class="indexterm" name="idm139684623848144"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_locker_lost"><code class="literal">Performance_schema_locker_lost</code></a>
        </p><p>
          How many events are <span class="quote">“<span class="quote">lost</span>”</span> or not recorded, due
          to the following conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
              Events are recursive (for example, waiting for A caused a
              wait on B, which caused a wait on C).
            </p></li><li class="listitem"><p>
              The depth of the nested events stack is greater than the
              limit imposed by the implementation.
</p></li></ul>
</div>
<p>
          Events recorded by the Performance Schema are not recursive,
          so this variable should always be 0.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_memory_classes_lost"></a>
          <a class="indexterm" name="idm139684623840432"></a>

          <a class="indexterm" name="idm139684623839392"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_memory_classes_lost"><code class="literal">Performance_schema_memory_classes_lost</code></a>
        </p><p>
          The number of times a memory instrument could not be loaded.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_metadata_lock_lost"></a>
          <a class="indexterm" name="idm139684623834800"></a>

          <a class="indexterm" name="idm139684623833760"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_metadata_lock_lost"><code class="literal">Performance_schema_metadata_lock_lost</code></a>
        </p><p>
          The number of metadata locks that could not be instrumented in
          the <a class="link" href="performance-schema.html#metadata-locks-table" title="25.11.12.1 The metadata_locks Table"><code class="literal">metadata_locks</code></a> table. This
          can be nonzero if the value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_metadata_locks"><code class="literal">performance_schema_max_metadata_locks</code></a>
          is too small.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_mutex_classes_lost"></a>
          <a class="indexterm" name="idm139684623826544"></a>

          <a class="indexterm" name="idm139684623825504"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_classes_lost"><code class="literal">Performance_schema_mutex_classes_lost</code></a>
        </p><p>
          How many mutex instruments could not be loaded.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_mutex_instances_lost"></a>
          <a class="indexterm" name="idm139684623820928"></a>

          <a class="indexterm" name="idm139684623819888"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_mutex_instances_lost"><code class="literal">Performance_schema_mutex_instances_lost</code></a>
        </p><p>
          How many mutex instrument instances could not be created.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_nested_statement_lost"></a>
          <a class="indexterm" name="idm139684623815296"></a>

          <a class="indexterm" name="idm139684623814176"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_nested_statement_lost"><code class="literal">Performance_schema_nested_statement_lost</code></a>
        </p><p>
          The number of stored program statements for which statistics
          were lost. This can be nonzero if the value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_statement_stack"><code class="literal">performance_schema_max_statement_stack</code></a>
          is too small.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_prepared_statements_lost"></a>
          <a class="indexterm" name="idm139684623808224"></a>

          <a class="indexterm" name="idm139684623807104"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_prepared_statements_lost"><code class="literal">Performance_schema_prepared_statements_lost</code></a>
        </p><p>
          The number of prepared statements that could not be
          instrumented in the
          <a class="link" href="performance-schema.html#prepared-statements-instances-table" title="25.11.6.4 The prepared_statements_instances Table"><code class="literal">prepared_statements_instances</code></a>
          table. This can be nonzero if the value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_prepared_statements_instances"><code class="literal">performance_schema_max_prepared_statements_instances</code></a>
          is too small.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_program_lost"></a>
          <a class="indexterm" name="idm139684623799792"></a>

          <a class="indexterm" name="idm139684623798688"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_program_lost"><code class="literal">Performance_schema_program_lost</code></a>
        </p><p>
          The number of stored programs for which statistics were lost.
          This can be nonzero if the value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_program_instances"><code class="literal">performance_schema_max_program_instances</code></a>
          is too small.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_rwlock_classes_lost"></a>
          <a class="indexterm" name="idm139684623792784"></a>

          <a class="indexterm" name="idm139684623791744"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_rwlock_classes_lost"><code class="literal">Performance_schema_rwlock_classes_lost</code></a>
        </p><p>
          How many rwlock instruments could not be loaded.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_rwlock_instances_lost"></a>
          <a class="indexterm" name="idm139684623787248"></a>

          <a class="indexterm" name="idm139684623786128"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_rwlock_instances_lost"><code class="literal">Performance_schema_rwlock_instances_lost</code></a>
        </p><p>
          How many rwlock instrument instances could not be created.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_session_connect_attrs_lost"></a>
          <a class="indexterm" name="idm139684623781568"></a>

          <a class="indexterm" name="idm139684623780448"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_session_connect_attrs_lost"><code class="literal">Performance_schema_session_connect_attrs_lost</code></a>
        </p><p>
          The number of connections for which connection attribute
          truncation has occurred. For a given connection, if the client
          sends connection attribute key/value pairs for which the
          aggregate size is larger than the reserved storage permitted
          by the value of the
          <a class="link" href="performance-schema.html#sysvar_performance_schema_session_connect_attrs_size"><code class="literal">performance_schema_session_connect_attrs_size</code></a>
          system variable, the Performance Schema truncates the
          attribute data and increments
          <a class="link" href="performance-schema.html#statvar_Performance_schema_session_connect_attrs_lost"><code class="literal">Performance_schema_session_connect_attrs_lost</code></a>.
          If this value is nonzero, you may wish to set
          <a class="link" href="performance-schema.html#sysvar_performance_schema_session_connect_attrs_size"><code class="literal">performance_schema_session_connect_attrs_size</code></a>
          to a larger value.
        </p><p>
          For more information about connection attributes, see
          <a class="xref" href="performance-schema.html#performance-schema-connection-attribute-tables" title="25.11.9 Performance Schema Connection Attribute Tables">Section 25.11.9, “Performance Schema Connection Attribute Tables”</a>.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_socket_classes_lost"></a>
          <a class="indexterm" name="idm139684623770288"></a>

          <a class="indexterm" name="idm139684623769248"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_socket_classes_lost"><code class="literal">Performance_schema_socket_classes_lost</code></a>
        </p><p>
          How many socket instruments could not be loaded.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_socket_instances_lost"></a>
          <a class="indexterm" name="idm139684623764672"></a>

          <a class="indexterm" name="idm139684623763552"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_socket_instances_lost"><code class="literal">Performance_schema_socket_instances_lost</code></a>
        </p><p>
          How many socket instrument instances could not be created.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_stage_classes_lost"></a>
          <a class="indexterm" name="idm139684623758992"></a>

          <a class="indexterm" name="idm139684623757952"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_stage_classes_lost"><code class="literal">Performance_schema_stage_classes_lost</code></a>
        </p><p>
          How many stage instruments could not be loaded.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_statement_classes_lost"></a>
          <a class="indexterm" name="idm139684623753376"></a>

          <a class="indexterm" name="idm139684623752288"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_statement_classes_lost"><code class="literal">Performance_schema_statement_classes_lost</code></a>
        </p><p>
          How many statement instruments could not be loaded.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_table_handles_lost"></a>
          <a class="indexterm" name="idm139684623747712"></a>

          <a class="indexterm" name="idm139684623746672"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_table_handles_lost"><code class="literal">Performance_schema_table_handles_lost</code></a>
        </p><p>
          How many table instrument instances could not be opened. This
          can be nonzero if the value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_handles"><code class="literal">performance_schema_max_table_handles</code></a>
          is too small.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_table_instances_lost"></a>
          <a class="indexterm" name="idm139684623740768"></a>

          <a class="indexterm" name="idm139684623739728"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_table_instances_lost"><code class="literal">Performance_schema_table_instances_lost</code></a>
        </p><p>
          How many table instrument instances could not be created.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_table_lock_stat_lost"></a>
          <a class="indexterm" name="idm139684623735136"></a>

          <a class="indexterm" name="idm139684623734096"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_table_lock_stat_lost"><code class="literal">Performance_schema_table_lock_stat_lost</code></a>
        </p><p>
          The number of tables for which lock statistics were lost. This
          can be nonzero if the value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_table_lock_stat"><code class="literal">performance_schema_max_table_lock_stat</code></a>
          is too small.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_thread_classes_lost"></a>
          <a class="indexterm" name="idm139684623728128"></a>

          <a class="indexterm" name="idm139684623727088"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_thread_classes_lost"><code class="literal">Performance_schema_thread_classes_lost</code></a>
        </p><p>
          How many thread instruments could not be loaded.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_thread_instances_lost"></a>
          <a class="indexterm" name="idm139684623722512"></a>

          <a class="indexterm" name="idm139684623721392"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_thread_instances_lost"><code class="literal">Performance_schema_thread_instances_lost</code></a>
        </p><p>
          The number of thread instances that could not be instrumented
          in the <a class="link" href="performance-schema.html#threads-table" title="25.11.16.3 The threads Table"><code class="literal">threads</code></a> table. This can be
          nonzero if the value of
          <a class="link" href="performance-schema.html#sysvar_performance_schema_max_thread_instances"><code class="literal">performance_schema_max_thread_instances</code></a>
          is too small.
        </p></li><li class="listitem"><p><a name="statvar_Performance_schema_users_lost"></a>
          <a class="indexterm" name="idm139684623714256"></a>

          <a class="indexterm" name="idm139684623713152"></a>

          <a class="link" href="performance-schema.html#statvar_Performance_schema_users_lost"><code class="literal">Performance_schema_users_lost</code></a>
        </p><p>
          The number of times a row could not be added to the
          <a class="link" href="performance-schema.html#users-table" title="25.11.8.3 The users Table"><code class="literal">users</code></a> table because it was full.
</p></li></ul>
</div>
<p>
      For information on using these variables to check Performance
      Schema status, see
      <a class="xref" href="performance-schema.html#performance-schema-status-monitoring" title="25.7 Performance Schema Status Monitoring">Section 25.7, “Performance Schema Status Monitoring”</a>.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-memory-model"></a>25.16 The Performance Schema Memory-Allocation Model</h2>

</div>

</div>

</div>
<p>
      The Performance Schema uses this memory allocation model:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          May allocate memory at server startup
        </p></li><li class="listitem"><p>
          May allocate additional memory during server operation
        </p></li><li class="listitem"><p>
          Never free memory during server operation (although it might
          be recycled)
        </p></li><li class="listitem"><p>
          Free all memory used at shutdown
</p></li></ul>
</div>
<p>
      The result is to relax memory constraints so that the Performance
      Schema can be used with less configuration, and to decrease the
      memory footprint so that consumption scales with server load.
      Memory used depends on the load actually seen, not the load
      estimated or explicitly configured for.
    </p><p>
      Several Performance Schema sizing parameters are autoscaled and
      need not be configured explicitly unless you want to establish an
      explicit limit on memory allocation:
    </p><pre data-lang="none" class="programlisting">
performance_schema_accounts_size
performance_schema_hosts_size
performance_schema_max_cond_instances
performance_schema_max_file_instances
performance_schema_max_index_stat
performance_schema_max_metadata_locks
performance_schema_max_mutex_instances
performance_schema_max_prepared_statements_instances
performance_schema_max_program_instances
performance_schema_max_rwlock_instances
performance_schema_max_socket_instances
performance_schema_max_table_handles
performance_schema_max_table_instances
performance_schema_max_table_lock_stat
performance_schema_max_thread_instances
performance_schema_users_size
</pre><p>
      For an autoscaled parameter, configuration works like this:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          With the value set to -1 (the default), the parameter is
          autoscaled:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
              The corresponding internal buffer is empty initially and
              no memory is allocated.
            </p></li><li class="listitem"><p>
              As the Performance Schema collects data, memory is
              allocated in the corresponding buffer. The buffer size is
              unbounded, and may grow with the load.
</p></li></ul>
</div>
</li><li class="listitem"><p>
          With the value set to 0:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
              The corresponding internal buffer is empty initially and
              no memory is allocated.
</p></li></ul>
</div>
</li><li class="listitem"><p>
          With the value set to <em class="replaceable"><code>N</code></em> &gt; 0:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
              The corresponding internal buffer is empty initially and
              no memory is allocated.
            </p></li><li class="listitem"><p>
              As the Performance Schema collects data, memory is
              allocated in the corresponding buffer, until the buffer
              size reaches <em class="replaceable"><code>N</code></em>.
            </p></li><li class="listitem"><p>
              Once the buffer size reaches <em class="replaceable"><code>N</code></em>,
              no more memory is allocated. Data collected by the
              Performance Schema for this buffer is lost, and any
              corresponding <span class="quote">“<span class="quote">lost instance</span>”</span> counters are
              incremented.
</p></li></ul>
</div>
</li></ul>
</div>
<p>
      To see how much memory the Performance Schema is using, check the
      instruments designed for that purpose. The Performance Schema
      allocates memory internally and associates each buffer with a
      dedicated instrument so that memory consumption can be traced to
      individual buffers. Instruments named with the prefix
      <code class="literal">memory/performance_schema/</code> expose how much
      memory is allocated for these internal buffers. The buffers are
      global to the server, so the instruments are displayed only in the
      <a class="link" href="performance-schema.html#memory-summary-tables" title="25.11.15.9 Memory Summary Tables"><code class="literal">memory_summary_global_by_event_name</code></a>
      table, and not in other
      <code class="literal">memory_summary_by_<em class="replaceable"><code>xxx</code></em>_by_event_name</code>
      tables.
    </p><p>
      This query shows the information associated with the memory
      instruments:
    </p><pre data-lang="sql" class="programlisting">
SELECT * FROM memory_summary_global_by_event_name
WHERE EVENT_NAME LIKE 'memory/performance_schema/%';
</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-and-plugins"></a>25.17 Performance Schema and Plugins</h2>

</div>

</div>

</div>
<p>
      Removing a plugin with <a class="link" href="sql-syntax.html#uninstall-plugin" title="13.7.3.4 UNINSTALL PLUGIN Syntax"><code class="literal">UNINSTALL
      PLUGIN</code></a> does not affect information already collected for
      code in that plugin. Time spent executing the code while the
      plugin was loaded was still spent even if the plugin is unloaded
      later. The associated event information, including aggregate
      information, remains readable in
      <code class="literal">performance_schema</code> database tables. For
      additional information about the effect of plugin installation and
      removal, see
      <a class="xref" href="performance-schema.html#performance-schema-status-monitoring" title="25.7 Performance Schema Status Monitoring">Section 25.7, “Performance Schema Status Monitoring”</a>.
    </p><p>
      A plugin implementor who instruments plugin code should document
      its instrumentation characteristics to enable those who load the
      plugin to account for its requirements. For example, a third-party
      storage engine should include in its documentation how much memory
      the engine needs for mutex and other instruments.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-examples"></a>25.18 Using the Performance Schema to Diagnose Problems</h2>

</div>

</div>

</div>
<div class="toc">
<dl class="toc"><dt><span class="section"><a href="performance-schema.html#performance-schema-query-profiling">25.18.1 Query Profiling Using Performance Schema</a></span></dt></dl>
</div>
<a class="indexterm" name="idm139684623674320"></a><a class="indexterm" name="idm139684623672864"></a><p>
      The Performance Schema is a tool to help a DBA do performance
      tuning by taking real measurements instead of <span class="quote">“<span class="quote">wild
      guesses.</span>”</span> This section demonstrates some ways to use the
      Performance Schema for this purpose. The discussion here relies on
      the use of event filtering, which is described in
      <a class="xref" href="performance-schema.html#performance-schema-filtering" title="25.4.2 Performance Schema Event Filtering">Section 25.4.2, “Performance Schema Event Filtering”</a>.
    </p><p>
      The following example provides one methodology that you can use to
      analyze a repeatable problem, such as investigating a performance
      bottleneck. To begin, you should have a repeatable use case where
      performance is deemed <span class="quote">“<span class="quote">too slow</span>”</span> and needs
      optimization, and you should enable all instrumentation (no
      pre-filtering at all).
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1"><li class="listitem"><p>
          Run the use case.
        </p></li><li class="listitem"><p>
          Using the Performance Schema tables, analyze the root cause of
          the performance problem. This analysis will rely heavily on
          post-filtering.
        </p></li><li class="listitem"><p>
          For problem areas that are ruled out, disable the
          corresponding instruments. For example, if analysis shows that
          the issue is not related to file I/O in a particular storage
          engine, disable the file I/O instruments for that engine. Then
          truncate the history and summary tables to remove previously
          collected events.
        </p></li><li class="listitem"><p>
          Repeat the process at step 1.
        </p><p>
          At each iteration, the Performance Schema output, particularly
          the <a class="link" href="performance-schema.html#events-waits-history-long-table" title="25.11.4.3 The events_waits_history_long Table"><code class="literal">events_waits_history_long</code></a>
          table, will contain less and less <span class="quote">“<span class="quote">noise</span>”</span> caused
          by nonsignificant instruments, and given that this table has a
          fixed size, will contain more and more data relevant to the
          analysis of the problem at hand.
        </p><p>
          At each iteration, investigation should lead closer and closer
          to the root cause of the problem, as the
          <span class="quote">“<span class="quote">signal/noise</span>”</span> ratio will improve, making
          analysis easier.
        </p></li><li class="listitem"><p>
          Once a root cause of performance bottleneck is identified,
          take the appropriate corrective action, such as:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              Tune the server parameters (cache sizes, memory, and so
              forth).
            </p></li><li class="listitem"><p>
              Tune a query by writing it differently,
            </p></li><li class="listitem"><p>
              Tune the database schema (tables, indexes, and so forth).
            </p></li><li class="listitem"><p>
              Tune the code (this applies to storage engine or server
              developers only).
</p></li></ul>
</div>
</li><li class="listitem"><p>
          Start again at step 1, to see the effects of the changes on
          performance.
</p></li></ol>
</div>
<p>
      The <code class="literal">mutex_instances.LOCKED_BY_THREAD_ID</code> and
      <code class="literal">rwlock_instances.WRITE_LOCKED_BY_THREAD_ID</code>
      columns are extremely important for investigating performance
      bottlenecks or deadlocks. This is made possible by Performance
      Schema instrumentation as follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1"><li class="listitem"><p>
          Suppose that thread 1 is stuck waiting for a mutex.
        </p></li><li class="listitem"><p>
          You can determine what the thread is waiting for:
        </p><pre data-lang="sql" class="programlisting">
SELECT * FROM events_waits_current WHERE THREAD_ID = <em class="replaceable"><code>thread_1</code></em>;
</pre><p>
          Say the query result identifies that the thread is waiting for
          mutex A, found in
          <code class="literal">events_waits_current.OBJECT_INSTANCE_BEGIN</code>.
        </p></li><li class="listitem"><p>
          You can determine which thread is holding mutex A:
        </p><pre data-lang="sql" class="programlisting">
SELECT * FROM mutex_instances WHERE OBJECT_INSTANCE_BEGIN = <em class="replaceable"><code>mutex_A</code></em>;
</pre><p>
          Say the query result identifies that it is thread 2 holding
          mutex A, as found in
          <code class="literal">mutex_instances.LOCKED_BY_THREAD_ID</code>.
        </p></li><li class="listitem"><p>
          You can see what thread 2 is doing:
        </p><pre data-lang="sql" class="programlisting">
SELECT * FROM events_waits_current WHERE THREAD_ID = <em class="replaceable"><code>thread_2</code></em>;
</pre></li></ol>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="performance-schema-query-profiling"></a>25.18.1 Query Profiling Using Performance Schema</h3>

</div>

</div>

</div>
<p>
        The following example demonstrates how to use Performance Schema
        statement events and stage events to retrieve data comparable to
        profiling information provided by <a class="link" href="sql-syntax.html#show-profiles" title="13.7.5.31 SHOW PROFILES Syntax"><code class="literal">SHOW
        PROFILES</code></a> and <a class="link" href="sql-syntax.html#show-profile" title="13.7.5.30 SHOW PROFILE Syntax"><code class="literal">SHOW
        PROFILE</code></a> statements.
      </p><p>
        The <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table can be used
        to limit the collection of historical events by host, user, or
        account to reduce runtime overhead and the amount of data
        collected in history tables. The first step of the example shows
        how to limit collection of historical events to a specific user.
      </p><p>
        Performance Schema displays event timer information in
        picoseconds (trillionths of a second) to normalize timing data
        to a standard unit. In the following example,
        <code class="literal">TIMER_WAIT</code> values are divided by
        1000000000000 to show data in units of seconds. Values are also
        truncated to 6 decimal places to display data in the same format
        as <a class="link" href="sql-syntax.html#show-profiles" title="13.7.5.31 SHOW PROFILES Syntax"><code class="literal">SHOW PROFILES</code></a> and
        <a class="link" href="sql-syntax.html#show-profile" title="13.7.5.30 SHOW PROFILE Syntax"><code class="literal">SHOW PROFILE</code></a> statements.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1"><li class="listitem"><p>
            Limit the collection of historical events to the user that
            will run the query. By default,
            <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> is configured to
            allow monitoring and historical event collection for all
            foreground threads:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM performance_schema.setup_actors;</code></strong>
+------+------+------+---------+---------+
| HOST | USER | ROLE | ENABLED | HISTORY |
+------+------+------+---------+---------+
| %    | %    | %    | YES     | YES     |
+------+------+------+---------+---------+
</pre><p>
            Update the default row in the
            <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table to disable
            historical event collection and monitoring for all
            foreground threads, and insert a new row that enables
            monitoring and historical event collection for the user that
            will run the query:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE performance_schema.setup_actors SET ENABLED = 'NO', HISTORY = 'NO'
       WHERE HOST = '%' AND USER = '%';</code></strong>

mysql&gt; <strong class="userinput"><code>INSERT INTO performance_schema.setup_actors (HOST,USER,ROLE,ENABLED,HISTORY)
       VALUES('localhost','test_user','%','YES','YES');</code></strong>
</pre><p>
            Data in the <a class="link" href="performance-schema.html#setup-actors-table" title="25.11.2.1 The setup_actors Table"><code class="literal">setup_actors</code></a> table
            should now appear similar to the following:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM performance_schema.setup_actors;</code></strong>
+-----------+-----------+------+---------+---------+
| HOST      | USER      | ROLE | ENABLED | HISTORY |
+-----------+-----------+------+---------+---------+
| %         | %         | %    | NO      | NO      |
| localhost | test_user | %    | YES     | YES     |
+-----------+-----------+------+---------+---------+
</pre></li><li class="listitem"><p>
            Ensure that statement and stage instrumentation is enabled
            by updating the
            <a class="link" href="performance-schema.html#setup-instruments-table" title="25.11.2.3 The setup_instruments Table"><code class="literal">setup_instruments</code></a> table. Some
            instruments may already be enabled by default.
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE performance_schema.setup_instruments SET ENABLED = 'YES', TIMED = 'YES'
       WHERE NAME LIKE '%statement/%';</code></strong>

mysql&gt; <strong class="userinput"><code>UPDATE performance_schema.setup_instruments SET ENABLED = 'YES', TIMED = 'YES'
       WHERE NAME LIKE '%stage/%';</code></strong>
</pre></li><li class="listitem"><p>
            Ensure that <code class="literal">events_statements_*</code> and
            <code class="literal">events_stages_*</code> consumers are enabled.
            Some consumers may already be enabled by default.
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>UPDATE performance_schema.setup_consumers SET ENABLED = 'YES'
       WHERE NAME LIKE '%events_statements_%';</code></strong>

mysql&gt; <strong class="userinput"><code>UPDATE performance_schema.setup_consumers SET ENABLED = 'YES'
       WHERE NAME LIKE '%events_stages_%';</code></strong>
</pre></li><li class="listitem"><p>
            Under the user account you are monitoring, run the statement
            that you want to profile. For example:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT * FROM employees.employees WHERE emp_no = 10001;</code></strong>
+--------+------------+------------+-----------+--------+------------+
| emp_no | birth_date | first_name | last_name | gender | hire_date |
+--------+------------+------------+-----------+--------+------------+
|  10001 | 1953-09-02 | Georgi     | Facello   | M      | 1986-06-26 |
+--------+------------+------------+-----------+--------+------------+
</pre></li><li class="listitem"><p>
            Identify the <code class="literal">EVENT_ID</code> of the statement by
            querying the
            <a class="link" href="performance-schema.html#events-statements-history-long-table" title="25.11.6.3 The events_statements_history_long Table"><code class="literal">events_statements_history_long</code></a>
            table. This step is similar to running
            <a class="link" href="sql-syntax.html#show-profiles" title="13.7.5.31 SHOW PROFILES Syntax"><code class="literal">SHOW PROFILES</code></a> to identify the
            <code class="literal">Query_ID</code>. The following query produces
            output similar to <a class="link" href="sql-syntax.html#show-profiles" title="13.7.5.31 SHOW PROFILES Syntax"><code class="literal">SHOW
            PROFILES</code></a>:
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT EVENT_ID, TRUNCATE(TIMER_WAIT/1000000000000,6) as Duration, SQL_TEXT
       FROM performance_schema.events_statements_history_long WHERE SQL_TEXT like '%10001%';</code></strong>
+----------+----------+--------------------------------------------------------+
| event_id | duration | sql_text                                               |
+----------+----------+--------------------------------------------------------+
|       31 | 0.028310 | SELECT * FROM employees.employees WHERE emp_no = 10001 |
+----------+----------+--------------------------------------------------------+
</pre></li><li class="listitem"><p>
            Query the
            <a class="link" href="performance-schema.html#events-stages-history-long-table" title="25.11.5.3 The events_stages_history_long Table"><code class="literal">events_stages_history_long</code></a>
            table to retrieve the statement's stage events. Stages are
            linked to statements using event nesting. Each stage event
            record has a <code class="literal">NESTING_EVENT_ID</code> column that
            contains the <code class="literal">EVENT_ID</code> of the parent
            statement.
          </p><pre data-lang="sql" class="programlisting">
mysql&gt; <strong class="userinput"><code>SELECT event_name AS Stage, TRUNCATE(TIMER_WAIT/1000000000000,6) AS Duration
       FROM performance_schema.events_stages_history_long WHERE NESTING_EVENT_ID=31;</code></strong>
+--------------------------------+----------+
| Stage                          | Duration |
+--------------------------------+----------+
| stage/sql/starting             | 0.000080 |
| stage/sql/checking permissions | 0.000005 |
| stage/sql/Opening tables       | 0.027759 |
| stage/sql/init                 | 0.000052 |
| stage/sql/System lock          | 0.000009 |
| stage/sql/optimizing           | 0.000006 |
| stage/sql/statistics           | 0.000082 |
| stage/sql/preparing            | 0.000008 |
| stage/sql/executing            | 0.000000 |
| stage/sql/Sending data         | 0.000017 |
| stage/sql/end                  | 0.000001 |
| stage/sql/query end            | 0.000004 |
| stage/sql/closing tables       | 0.000006 |
| stage/sql/freeing items        | 0.000272 |
| stage/sql/cleaning up          | 0.000001 |
+--------------------------------+----------+
</pre></li></ol>
</div>

</div>

</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="performance-schema-variable-table-migration"></a>25.19 Migrating to Performance Schema System and Status Variable Tables</h2>

</div>

</div>

</div>
<p>
      The <code class="literal">INFORMATION_SCHEMA</code> has tables that contain
      system and status variable information (see
      <a class="xref" href="information-schema.html#variables-table" title="24.11 The INFORMATION_SCHEMA GLOBAL_VARIABLES and SESSION_VARIABLES Tables">Section 24.11, “The INFORMATION_SCHEMA GLOBAL_VARIABLES and SESSION_VARIABLES Tables”</a>, and
      <a class="xref" href="information-schema.html#status-table" title="24.10 The INFORMATION_SCHEMA GLOBAL_STATUS and SESSION_STATUS Tables">Section 24.10, “The INFORMATION_SCHEMA GLOBAL_STATUS and SESSION_STATUS Tables”</a>). The Performance Schema also
      contains system and status variable tables (see
      <a class="xref" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables">Section 25.11.13, “Performance Schema System Variable Tables”</a>, and
      <a class="xref" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables">Section 25.11.14, “Performance Schema Status Variable Tables”</a>). The
      Performance Schema tables are intended to replace the
      <code class="literal">INFORMATION_SCHEMA</code> tables, which are deprecated
      as of MySQL 5.7.6 and will be removed in a future MySQL release.
    </p><p>
      This section describes the intended migration path away from the
      <code class="literal">INFORMATION_SCHEMA</code> system and status variable
      tables to the corresponding Performance Schema tables. Application
      developers should use this information as guidance regarding the
      changes required to access system and status variables in MySQL
      5.7.6 and up as the <code class="literal">INFORMATION_SCHEMA</code> tables
      become deprecated and eventually are removed.
    </p><p>
      <span class="bold"><strong>MySQL 5.6</strong></span>
    </p><p>
      In MySQL 5.6, system and status variable information is available
      from these <code class="literal">SHOW</code> statements:
    </p><pre data-lang="sql" class="programlisting">
SHOW VARIABLES
SHOW STATUS
</pre><p>
      And from these <code class="literal">INFORMATION_SCHEMA</code> tables:
    </p><pre data-lang="none" class="programlisting">
INFORMATION_SCHEMA.GLOBAL_VARIABLES
INFORMATION_SCHEMA.SESSION_VARIABLES

INFORMATION_SCHEMA.GLOBAL_STATUS
INFORMATION_SCHEMA.SESSION_STATUS
</pre><p>
      <span class="bold"><strong>MySQL 5.7</strong></span>
    </p><p>
      As of MySQL 5.7.6, the Performance Schema includes these tables as
      new sources of system and status variable information:
    </p><pre data-lang="none" class="programlisting">
performance_schema.global_variables
performance_schema.session_variables
performance_schema.variables_by_thread

performance_schema.global_status
performance_schema.session_status
performance_schema.status_by_thread
performance_schema.status_by_account
performance_schema.status_by_host
performance_schema.status_by_user
</pre><p>
      MySQL 5.7.6 also adds a
      <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56</code></a> system
      variable to control how the server makes system and status
      variable information available.
    </p><p>
      When <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56</code></a> is
      <code class="literal">ON</code>, compatibility with MySQL 5.6 is enabled.
      The older system and status variable sources
      (<code class="literal">SHOW</code> statements,
      <code class="literal">INFORMATION_SCHEMA</code> tables) are available with
      semantics identical to MySQL 5.6. Applications should run as is,
      with no code changes, and should see the same variable names and
      values as in MySQL 5.6. Warnings occur under these circumstances:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          A deprecation warning is raised when selecting from the
          <code class="literal">INFORMATION_SCHEMA</code> tables.
        </p></li><li class="listitem"><p>
          In MySQL 5.7.6 and 5.7.7, a deprecation warning is raised when
          using a <code class="literal">WHERE</code> clause with the
          <code class="literal">SHOW</code> statements. This behavior does not
          occur as of MySQL 5.7.8.
</p></li></ul>
</div>
<p>
      When <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56</code></a> is
      <code class="literal">OFF</code>, compatibility with MySQL 5.6 is disabled
      and several changes result. Applications must be revised as
      follows to run properly:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          Selecting from the <code class="literal">INFORMATION_SCHEMA</code>
          tables produces an error. Applications that access the
          <code class="literal">INFORMATION_SCHEMA</code> tables should be revised
          to use the corresponding Performance Schema tables instead.
        </p><p>
          Before MySQL 5.7.9, selecting from the
          <code class="literal">INFORMATION_SCHEMA</code> tables produces an empty
          result set plus a deprecation warning. This was not sufficient
          notice to signal the need to migrate to the corresponding
          Performance Schema system and status variable tables for the
          case that
          <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56=OFF</code></a>.
          Producing an error in MySQL 5.7.9 and higher makes it more
          evident that an application is operating under conditions that
          require modification, as well as where the problem lies.
        </p><p>
          In MySQL 5.7.6 and 5.7.7, the Performance Schema
          <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">session_variables</code></a> and
          <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">session_status</code></a> tables do not
          fully reflect all variable values in effect for the current
          session; they include no rows for global variables that have
          no session counterpart. This is corrected in MySQL 5.7.8.
        </p></li><li class="listitem"><p>
          Output for the <code class="literal">SHOW</code> statements is produced
          using the underlying Performance Schema tables. Applications
          written to use these statements can still use them, but it is
          best to use MySQL 5.7.8 or higher. In MySQL 5.7.6 and 5.7.7,
          the results may differ:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>
              <code class="literal">SHOW [SESSION] VARIABLES</code> output does
              not include global variables that have no session
              counterpart.
            </p></li><li class="listitem"><p>
              Using a <code class="literal">WHERE</code> clause with the
              <code class="literal">SHOW</code> statements produces an error.
</p></li></ul>
</div>
</li><li class="listitem"><p>
          These <code class="literal">Slave_<em class="replaceable"><code>xxx</code></em></code>
          status variables become unavailable through
          <a class="link" href="sql-syntax.html#show-status" title="13.7.5.35 SHOW STATUS Syntax"><code class="literal">SHOW STATUS</code></a>:
        </p><pre data-lang="none" class="programlisting">
Slave_heartbeat_period
Slave_last_heartbeat
Slave_received_heartbeats
Slave_retried_transactions
Slave_running
</pre><p>
          Applications that use these status variables should be revised
          to obtain this information using the replication-related
          Performance Schema tables. For details, see
          <a class="xref" href="server-administration.html#sysvar_show_compatibility_56_slave_status" title="Effect of show_compatibility_56 on Slave Status Variables">Effect of show_compatibility_56 on Slave Status Variables</a>.
        </p></li><li class="listitem"><p>
          The Performance Schema does not collect statistics for
          <code class="literal">Com_<em class="replaceable"><code>xxx</code></em></code> status
          variables in the status variable tables. To obtain global and
          per-session statement execution counts, use the
          <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_global_by_event_name</code></a>
          and
          <a class="link" href="performance-schema.html#statement-summary-tables" title="25.11.15.3 Statement Summary Tables"><code class="literal">events_statements_summary_by_thread_by_event_name</code></a>
          tables, respectively.
</p></li></ul>
</div>
<p>
      <span class="bold"><strong>Migration and Privileges</strong></span>
    </p><p>
      Initially, with the introduction of Performance Schema system and
      status variable tables in MySQL 5.7.6, access to those tables
      required the <a class="link" href="security.html#priv_select"><code class="literal">SELECT</code></a> privilege, just
      as for other Performance Schema tables. However, this had the
      consequence that when
      <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56=OFF</code></a>, the
      <a class="link" href="sql-syntax.html#show-variables" title="13.7.5.39 SHOW VARIABLES Syntax"><code class="literal">SHOW VARIABLES</code></a> and
      <a class="link" href="sql-syntax.html#show-status" title="13.7.5.35 SHOW STATUS Syntax"><code class="literal">SHOW STATUS</code></a> statements also
      required the <a class="link" href="security.html#priv_select"><code class="literal">SELECT</code></a> privilege: With
      compatibility disabled, output for those statements was taken from
      the Performance Schema
      <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">global_variables</code></a>,
      <a class="link" href="performance-schema.html#performance-schema-system-variable-tables" title="25.11.13 Performance Schema System Variable Tables"><code class="literal">session_variables</code></a>,
      <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">global_status</code></a>, and
      <a class="link" href="performance-schema.html#performance-schema-status-variable-tables" title="25.11.14 Performance Schema Status Variable Tables"><code class="literal">session_status</code></a> tables.
    </p><p>
      As of MySQL 5.7.9, those Performance Schema tables are world
      readable and accessible without the
      <a class="link" href="security.html#priv_select"><code class="literal">SELECT</code></a> privilege. Consequently,
      <a class="link" href="sql-syntax.html#show-variables" title="13.7.5.39 SHOW VARIABLES Syntax"><code class="literal">SHOW VARIABLES</code></a> and
      <a class="link" href="sql-syntax.html#show-status" title="13.7.5.35 SHOW STATUS Syntax"><code class="literal">SHOW STATUS</code></a> do not require
      privileges on the underlying Performance Schema tables from which
      their output is produced when
      <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56=OFF</code></a>.
    </p><p>
      <span class="bold"><strong>Beyond MySQL 5.7</strong></span>
    </p><p>
      In a MySQL 8.0, the <code class="literal">INFORMATION_SCHEMA</code> variable
      tables and the
      <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56</code></a> system
      variable are removed, and output from the <code class="literal">SHOW</code>
      statements is always based on the underlying Performance Schema
      tables.
    </p><p>
      Applications that have been revised to work in MySQL 5.7 when
      <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56=OFF</code></a> should
      work without further changes, except that it will not be possible
      to test or set
      <a class="link" href="server-administration.html#sysvar_show_compatibility_56"><code class="literal">show_compatibility_56</code></a> because it
      will not exist.
</p>
</div>

</div>
<div class="copyright-footer">

</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="information-schema.html">Prev</a></td>
<td width="20%" align="center"><a accesskey="u" href="">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="sys-schema.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 24 INFORMATION_SCHEMA Tables</td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top">Chapter 26 MySQL sys Schema</td>
</tr>
</table>
</div>
</body>
</html>
